trouble using ifstream as a class member

W. J. Atsma withaar@wylch.fastmail.fm
Sun May 16 22:44:00 GMT 2004


I am forced to compile against an old version of the library, 2.9.0. This
code works fine under the current library/compiler.

Given the following:

#include <fstream>

class BStream {
public:
...
   void Open(const std::string& filename);
   void ReadHeader();

private:
   std::ifstream tis;
};

After the file has been opened succesfully a call to read() in
ReadHeader()
fails to read any characters and the eof bit is set. The same sequence of
commands works if std::ifstream tis is not wrapped as a class member.

Why is this?
How can I make it work?

Thank you,

W
-- 

   Healthy people don't lie.



More information about the Libstdc++ mailing list