\n to \r\n in stdout

John Love-Jensen eljay@adobe.com
Mon Nov 7 12:24:00 GMT 2005


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



More information about the Gcc-help mailing list