TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CAMERON CLARK
from: JERRY COFFIN
date: 1997-08-28 15:42:00
subject: stream bug???

On (25 Aug 97) Cameron Clark wrote to All...
 CC>     ofstream outf("out.bin");
You're opening the stream in translated (text) mode...
 CC>     char string[6];
 CC>     strcpy(string,"12345");
 CC>     string[strlen(string)] = '\n';
And writing a new-line character.  In text mode, this is translated to
the string "\r\n", at least with most DOS, OS/2 and Win32 compilers.  If
you don't want translation to take place, you need to open the stream in
untranslated mode:
    ofstream outf("out.bin", ios::binary);
A few compilers use `ios::bin' instead of `ios::binary'.
    Later,
    Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.