This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
trouble using ifstream as a class member
- From: "W. J. Atsma" <withaar at wylch dot fastmail dot fm>
- To: libstdc++ at gcc dot gnu dot org
- Date: Mon, 17 May 2004 00:44:37 +0200
- Subject: trouble using ifstream as a class member
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.