Possible bug with <sstream>
Gabriel Dos Reis
gdr@sourceware.cygnus.com
Wed Dec 8 22:00:00 GMT 1999
The following problem was reported on news:fr.comp.lang.c++ .
Because of unfortunate build problems I'm having on solaris-2.7 I
can't tell whether the bug was corrected in current CVS source.
Benjamin, can you infirm or confirm?
Basically tellg() isn't reporting the right position due to whatever
reasons.
-- Gaby
------------- Beginning of Article -------------
Comment expliquer ce comportement étrange avec ceci:
-=-=-=-
/* g++ -Wall -O2 */
#include <iostream>
#include <fstream>
using namespace std ;
int main( void )
{
/* /dev/zero est un fichier de taille infinie ne contenant
que des zeros. (Le pbl est aussi reproductible avec n'importe
quel autre fichier) */
ifstream file( "/dev/zero" ) ;
cout << hex << file.tellg() << endl ;
cout << hex << file.tellg() << endl ;
file.seekg( 10 , ifstream::cur ) ;
cout << hex << file.tellg() << endl ;
file.seekg( 10 , ifstream::cur ) ;
cout << hex << file.tellg() << endl ;
cout << hex << file.tellg() << endl ;
}
-=-=-=-
qui donne:
-=-=-=-
0
2000
200a
6014
8014
-=-=-=-
?
(gcc 2.95.2 / libstdc++-2.90.6 (unstable ?) / Linux 2.2)
------------- End of Article -------------
More information about the Libstdc++
mailing list