Here is a minimalist code :
#include <string>
#include <sstream>
#include <iostream>
int main ()
{
std::string str = "spam" ;
std::istringstream isz( str ) ;
isz.seekg( 1,std::ios_base::beg ) ; std::cout << isz.fail() ;
isz.seekg( 1,std::ios_base::cur ) ; std::cout << isz.fail() ;
isz.seekg( 1,std::ios_base::end ) ; std::cout << isz.fail() ;
return 0 ;
}
I get 001 meaning the last seekg failed.
I the same with linux/g++ and win/MSVC.
I can't find such limitation in C++/stl documentation...
Any idea ?
Thx
Sorry, I missed a point :
When I call
seekg( 1,std::ios_base::end ), I try go 1 char after the end (which fails as it should).I have to call
seekg( -1,std::ios_base::end )to go 1 char before the end.