visual c++ - Any Alternate way for writing to a file other than ofstream -


I am performing file operations (Litfile) which brings data from XML and output file (a1.txt) Writes.

I am using MS Visual C ++ 2008 and Windows XP.

Currently I am using this method of writing in the output file.

  01.ofstreamhdr outputfile; 02./* Some other stmts * / 03.hdrOutputFile.open (filename, std :: IOS :: out); 04. 05.hdrOutputFile & lt; & Lt; "#include \" commondata.h \ "" & lt; & Lt; Andal; 06.hdrOutputFile & lt; & Lt; "#include \" Commonconfig.h \ "" & lt; & Lt; Andal; 07.hdrOutputFile & lt; & Lt; "#include \" commontable.h \ "" & lt; & Lt; Andal & lt; & Lt; Andal; 08. hdrOutputFile & lt; & Lt; "#Prima Pack (Push, 1)" & lt; & Lt; Andal; 09.hdrOutputFile & lt; & Lt; "Typifier structure \ n {" & lt; & Lt; Andal; 10./* simliar hdrOutputFiles statements ... * .. .. /  

I have about 250 lines for writing. There is no better way to do this.

I want to reduce this hdroutputfile and want to use buffer to do this.

Please guide me how to do that action

I mean,

  buff = "#include \" commontable.h \ "" + "Type \ nfile \ n {" + ....... hdrOutputFile & lt; & Lt; Fond    

Lesson "itemprop =" text ">

How about In:

  const char * buffer = "This is a line of text \ n" "This is the beginning of the other and it is the end of the same line \ n" "and so on \ n "" HdrOutputFile & lt; & Lt; Buffer;  

In both C and C ++, string strings such as string are automatically inserted into a string.


Comments