0
我正在执行文件操作(writeToFile),它从XML读取数据并写入输出文件(a1.txt)。任何替代方式写入文件以外的文件
我正在使用MS Visual C++ 2008和Windows XP中。
目前我使用写入到输出文件的这个方法..
01.ofstreamhdr OutputFile;
02./* few other stmts */
03.hdrOutputFile.open(fileName, std::ios::out);
04.
05.hdrOutputFile << "#include \"commondata.h\""<< endl ;
06.hdrOutputFile << "#include \"Commonconfig.h\"" << endl ;
07.hdrOutputFile << "#include \"commontable.h\"" << endl << endl ;
08. hdrOutputFile << "#pragma pack(push,1)" << endl ;
09.hdrOutputFile << "typedef struct \n {" << endl ;
10./* simliar hdrOutputFiles statements... */..
我有大约250线写..是执行此任务的任何更好的办法。
我想减少此hdrOutputFile并使用缓冲区来执行此操作。
请指导我如何做到这一点。
我的意思是,
buff = "#include \"commontable.h\"" + "typedef struct \n {" + .......
hdrOutputFile << buff.
是这样,可能吗?
感谢
拉姆
一个地方要开始将格式化您的代码,以便更容易阅读:p – 2010-06-18 14:33:00