This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: Problem with ifstream
- To: Benoit Sibaud <benoit dot sibaud at rd dot francetelecom dot fr>
- Subject: Re: Problem with ifstream
- From: Levente Farkas <lfarkas at mindmaker dot hu>
- Date: Fri, 30 Jun 2000 10:48:01 +0200
- Cc: libstdc++ <libstdc++ at sourceware dot cygnus dot com>
- Organization: Mindmaker Ltd.
- References: <395C5B71.80F17BFE@rd.francetelecom.fr>
- Reply-To: lfarkas at mindmaker dot hu
Benoit Sibaud wrote:
>
> Hi,
>
> I use gcc 2.95.2 + libstdc++ 2.90.8.
> When I try to reuse an std::ifstream, I can't. Is it a) Normal b) My
> fault c) A bug d) Other ?
>
> Thanks in advance,
> Regards
>
> --
> Benoît Sibaud
> R&D Engineer France Telecom/BD/FTR&D/DAC/OAT
>
> ************
> #include <iostream>
> #include <fstream>
>
> int main()
> {
> std::ifstream ifs;
>
> ifs.open("FOO");
> std::cout << (bool)ifs << std::endl;
> std::string str;
> while(ifs) {
> getline(ifs, str);
> std::cout << str << std::endl;
> }
> ifs.close();
// I hope it'll help:-)
ifs.clear();
> ifs.open("FOO");
> std::cout << (bool)ifs << std::endl;
> while(ifs) {
> getline(ifs, str);
> std::cout << str << std::endl;
> }
> ifs.close();
> }
-- Levente
"The only thing worse than not knowing the truth is
ruining the bliss of ignorance."