Mail Archives: djgpp/1994/12/08/14:31:44
Dear all
I am having problems in using the file handling libraries under GPP.
I am trying to read a text file created using G++ with the streamed
I/O routines. The ifstream object opens the file OK, but returns EOF
for every file access afterwards. I am trying to extract newline
delimited strings and floats from the file. The code goes something
like this....
ifstream file;
file.open(filename, ios::nocreate);
if (!file.is_open()) cout << "Can't open file \n" // This works fine
float temp;
char buffer[100] = {0};
file >> buffer;
whereupon the file access fails, and file.eof() is set. I prototyped
this using (dare I say it) Microsoft Visual C++ 1.00 and it works
fine. Is there a known problem with streamed file input. A revised
version using standard C style file pointers works nicely.
Any ideas?
Ben Runnacles
Vision, Speech and Signal Processing Group,
University Of Southampton, U.K.
- Raw text -