This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Possible bug with <sstream>



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 -------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]