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)
|