This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: \n to \r\n in stdout


Hi Thales,

> I'm trying to open a binary file and print it to the stdout, but substituting
'\n' for "\r\n", the file generated is corrupted.

Have you tried opening the file in binary mode?

#include <fstream>

std::fstream f("myfile.bin",
   ios_base::binary | ios_base::in | ios_base::out);

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]