OOP and Filing Related Question

CAN WE READ AND WRITE AN OBJECT OF CLASS OF SIZE 10 MB???
The answer is yes.
can you kindly explain your answer
How much do you know?
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <cmath>
#include <conio.h>
using namespace std;

struct node3{
node3(){
nextContent = NULL;
for (int i = 0; i<1020; i++)
content[i] = '\0';
}

char content[1020];
node3* nextContent;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
struct node1{
node1(){
for (int i = 0; i<496; i++)
fileName[i] = '\0';
}

char fileName[496];
node3* contentAdress;
};
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
struct node2{
node3* contentAddress;
};

class fileSystem{
private:
node1 obj1[2097];
node2 obj2[8192];
node3 obj3[8192];
};


When I write
fileSystem* obj = new fileSystem();
ofstream os("file.dat", ios::binary);
os.write( reinterpret_cast<char*>(*obj), sizeof(*obj) );

in main.

I get:
error C2440: 'reinterpret_cast' : cannot convert from 'fileSystem' to 'char *'
1> Conversion requires a constructor or user-defined-conversion operator, which can't be used by const_cast or reinterpret_cast
Topic archived. No new replies allowed.