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