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;

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2021-06-20
  • 2022-12-23
  • 2021-07-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2021-10-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案