This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Possible bug with <sstream>
- To: libstdc++ at sourceware dot cygnus dot com
- Subject: Possible bug with <sstream>
- From: Gabriel Dos Reis <gdr at sourceware dot cygnus dot com>
- Date: 09 Dec 1999 07:01:16 +0100
- Cc: fjolliton at free dot fr
- Organization: None.
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 -------------