vc串行化读写过程

vc串行化读写

 

串行化读写需要  用CArchive做中介,首先生成一个CFile类,然后在CFile类的基础上生成CArchive,然后直接用>>或者<<读写

 

 

下面是读文件的过程,文件中有四个变量值x1,x2,y1,y2

CFile *file = NULL;
 file = new CFile("D://ae", CFile::modeRead);//生成CFile文件

 CArchive arr(file, CArchive::load);//生成CArchive


     arr>>x1>>x2>>y1>>y2;//直接读变量

 arr.Close();
 delete file;

 

你可能感兴趣的:(VC)