Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - setting stdout to binary?
Hello, I tried to set stdout to binary mode with setmode but it doesn't work. Compiling this code #include <stdio.h> #include <io.h> #include <fcntl.h> int main() { if(_setmode(fileno(stdout), _O_BINARY) < 0) fprintf(stderr, "Setmode failed\n"); printf("A\nB\nC\n"); return 0; } does not set the stdout to binary and doesn't print the failure message to stdout when compiled as W32 console or X32 application. Compiling this as a DOS-App the error message is printed. Is this a _setmode bug? - Heinz Mar 08 2004
"Heinz Saathoff" wrote:I tried to set stdout to binary mode with setmode but it doesn't work. Compiling this code #include <stdio.h> #include <io.h> #include <fcntl.h> int main() { if(_setmode(fileno(stdout), _O_BINARY) < 0) fprintf(stderr, "Setmode failed\n"); printf("A\nB\nC\n"); return 0; } does not set the stdout to binary and doesn't print the failure message to stdout when compiled as W32 console or X32 application. Compiling this as a DOS-App the error message is printed. Is this a _setmode bug? Mar 08 2004
Hello, Gisle Vanem wrote...Try freopen("con", "wb", stdout). Or stdout = fdopen(FILENO_STDOUT,"wb"); Mar 09 2004
|