Problem with ifstream

Benjamin Kosnik bkoz@redhat.com
Fri Jun 30 08:52:00 GMT 2000


> >   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();

This behavior was deemed Not A Bug. See this link for more info:

http://sourceware.cygnus.com/ml/libstdc++/2000-06/msg00254.html

-benjamin


More information about the Libstdc++ mailing list