Mail Archives: djgpp/1994/09/01/21:01:19
This little program will not work when compiled by gcc 2.6.0 with libgpp
2.60
---- test program ---
#include <iostream.h>
#include <fstream.h>
main()
{
ofstream of("test.dat", ios::bin);
of << "hello\nworld\n\r";
if (!of)
cerr << "Error writing to file\n";
}
It will work when compiled by MSVC (replacing ios::bin with
ios::binary).
To make it work with libgpp I need to use a line like this
ofstream of("test.dat", ios::bin|ios::out);
Is an ofstream object supposed to be for output?
--
Dong Liu <dliu AT ace DOT njit DOT edu>
Electrical and Computer Engineering Department
New Jersey Institute of Technology, Newark, NJ 07102
- Raw text -