For Programmers: Free Programming Magazines  


Home > Archive > VC Language > November 2005 > visual c++ / write to cout in binary mode?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author visual c++ / write to cout in binary mode?
Helmut Zeisel

2005-11-21, 7:04 pm

Visual C++: How can I write to std::cout in binary mode?

Helmut
Ulrich Eckhardt

2005-11-21, 7:04 pm

Helmut Zeisel wrote:
> Visual C++: How can I write to std::cout in binary mode?


There were recently some threads in comp.lang.c++.moderated which discussed
that topic, "Portable way to write binary data" and "For binary files use
only read() and write()", "codecvt and compression, again".

Uli

HZ

2005-11-21, 7:04 pm

Ulrich Eckhardt schrieb:

> Helmut Zeisel wrote:
>
> There were recently some threads in comp.lang.c++.moderated which discussed
> that topic, "Portable way to write binary data" and "For binary files use
> only read() and write()", "codecvt and compression, again".


I know that I have to use cout.write(). This, however, does not help as
long as cout is still in text mode. Fortunately in the meanwhile I
googled the answer myself: I have to use _setmode(1, _O_BINARY) before
the first write()

Helmut

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com