Any Alternate way for writing to a file other than ofstream

Posted by Aditya on Stack Overflow See other posts from Stack Overflow or by Aditya
Published on 2010-06-18T14:30:08Z Indexed on 2010/06/18 14:33 UTC
Read the original article Hit count: 224

Filed under:
|

Hi All,

I am performing file operations (writeToFile) which fetches the data from a xml and writes into a output file(a1.txt).

I am using MS Visual C++ 2008 and in windows XP.

currently i am using this method of writing to output file..

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... */..

I have around 250 lines to write.. Is any better way to perform this task.

I want to reduce this hdrOutputFile and use a buffer to do this.

Please guide me how to do that action.

I mean,

buff = "#include \"commontable.h\"" + "typedef struct \n {" + .......

hdrOutputFile << buff.

is this way possible?

Thanks

Ramm

© Stack Overflow or respective owner

Related posts about visual-c++

Related posts about file-io