Original Post
Hi, I'm having some difficulty understanding the behavior of this code. Could someone tell me what I'm doing wrong?
string temp("ABCDEFG");
istringstream sin(temp, istringstream::in);
while(sin)
cout <<sin.tellg() <<" " <<(char)sin.get() <<" " <<sin.tellg() <<endl;
gives me the output:
1 A 0
2 B 1
3 C 2
4 D 3
5 E 4
6 F 5
7 G 6
-1 ÿ 7
Why is sin.tellg() after the read smaller than sin.tellg() before the read? Thanks for your help -Cuppo