-
Notifications
You must be signed in to change notification settings - Fork 1
/
testBM.cpp
executable file
·50 lines (47 loc) · 1.04 KB
/
testBM.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
#include <fstream>
#include <list>
#include "BufferManager.h"
using namespace std;
int main()
{
BufferManager bm;
char *record = new char[4096];
for(int i = 0; i < 4096; i++)
{
record[i] = '5';
}
fstream out("test.bin", ios::out | ios::binary);
out.seekp(0, ios::beg);
out.write(record, 4096);
out.close();
Block *a = bm.find_block("test.bin", 0);
char *find = a->get_record();
find[2] = 'a';
find[4] = '7';
a->set_dirty();
bm.flush();
a = bm.find_block("test.bin", 0);
for (int i = 0; i < 4096; i++)
cout << a->get_record()[i];
// list<int> a;
// a.push_back(1);
// a.push_back(2);
// a.push_back(3);
// a.push_back(4);
// for(auto i : a)
// cout << i << " ";
// cout << endl;
// auto iter = a.begin();
// while (iter != a.end())
// {
// if(*iter != 3)
// a.erase(iter++);
// else
// iter++;
// }
// cout << endl;
// for(auto i : a)
// cout << i << " ";
cin.get();
}