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
|
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int array[2][5]=
{
{1,1,1,1,0},
{0,0,0,1,1}
};
int array2[2][5]=
{
{0,0,1,1,1},
{1,0,0,1,0}
};
fstream file("brainfart.bin",ios::in|ios::out|ios::binary|ios::app);
file.write(reinterpret_cast<char*>(array),sizeof(array));
cout<<file.tellg()<<endl;
cout<<file.tellp()<<endl;
file.seekg(0);
file.seekp(0);
file.write(reinterpret_cast<char*>(array2),sizeof(array2));
cout<<file.tellg()<<endl;
cout<<file.tellp()<<endl;
return 0;
}
|