Problem with ifstream
Benoit Sibaud
benoit.sibaud@rd.francetelecom.fr
Fri Jun 30 01:33:00 GMT 2000
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();
ifs.open("FOO");
std::cout << (bool)ifs << std::endl;
while(ifs) {
getline(ifs, str);
std::cout << str << std::endl;
}
ifs.close();
}
***********
$ cat FOO
blah
$
************
$ ./a.out
1
blah
0
*************
More information about the Libstdc++
mailing list