Veröffentlicht 25. August 200817 j Hallo, ich habe ein Problem in C++ (Microsoft Visual Studio 2008), und weis nach Stunden immer noch nicht weiter: Ich muss einen Zeilenumbruch im Unix-Stil (also 0x0a statt 0x0d0a) ausgeben - aber auch wenn ich in der Zeile cout<<"Hallo Welt\xA"; schreibe, bekomme ich dann in der Ausgabe (per Hexeditor angeschaut) ein normales 0x0d0a zu Gesicht. Gibt es da irgendeine Möglichkeit, das in einen Modus umzuschalten, wo nicht so intelligent gedacht wird? Danke, tsg
25. August 200817 j Da ich aber gerade nicht weiß, wie man den Modus von offenen Streams ändert, könnte dir evtl. folgendes helfen: Formatted output These member functions interpret and format the data to be written as sequences of characters. These type of operation is performed using member and global functions that overload the insertion operator (operator<<). Unformatted output Most of the other member functions of the ostream class are used to perform unformatted output operations, i.e. output operations that write the data as it is, with no formatting adaptations. These member functions can write a determined number of characters to the output character sequence (put, write) and manipulate the put pointer (seekp, tellp). von hier ostream - C++ Reference
25. August 200817 j Portabel geht's leider nicht. _setmode(_fileno(stdout), _O_BINARY); sollte unter Windows helfen. Du brauchst <io.h> und <fcntl.h>.
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.