Mail Archives: djgpp/1997/03/24/07:32:06
>I've tried to read from a file like this:
>File.read(buffer,8);
>And it doesn't work, Why? How can I change this so it works?
>I got DJGPP 2.01 gcc 2.7.2.1.
>
I assume that File is an ofstream object. If so, then I think it is a
mis-feature (bug ?) in DJGPP (or maybe gcc).
I opened the file in binary mode like this:
ifstream File("file.ext", ios::binary);
and the file doesn't read anything. The correction is:
ifstream File("file.ext", ios::binary | ios::in);
I read the header 'fstream.h' and it seems that whenever an ifstream
is opened as in the first statement ios::in is ORed with the mode.
This should correct the problem but somehow the ifstream does not read!
when the file is opened without specifying mode (i.e. text-mode)
there's no problem.
ifstream File("file.ext");
Eyal.
- Raw text -