Hi All,
I'm working on an old linux machine, which I don't have root access to. I've updated gcc and binutils to something more modern, gcc 4.1.2, binutils 2.17. glibc is 2.2.2, so pretty old.
I've noticed that istringstream 's don't work properly. Say the istringstream contains a few numbers, "3.5 10.2 72.0" . I can only read in one of the numbers. After the first number is read, the istringstream is invalidated! Anyone know what could be causing this?? I know my g++ is somewhat working, because pair 's work just fine, and they didn't work with the older version of gcc on this machine (2.9.6).
Here's my test program, and the output I see.
#include <string>
#include <iostream>
#include <sstream>
using namespace std;
int main (int argc, char* argv)
{
string A_String;
pair<double,double> A_Pair;
A_String="20.9 33.4";
istringstream A_ISS(A_String,ios::in);
cout << "A_String: " << A_String << endl;
cout << "A_ISS: " << A_ISS << endl;
cout << "A_ISS.str(): " << A_ISS.str() << endl;
A_ISS >> A_Pair.first;
cout << "A_ISS After ReadA: " << A_ISS << endl;
cout << "A_ISS.str() After ReadA: " << A_ISS.str() << endl;
A_ISS >> A_Pair.second;
cout << "A_ISS After ReadB: " << A_ISS << endl;
cout << "A_ISS.str() After ReadB: " << A_ISS.str() << endl;
cout << "A and B: " << A_Pair.first << "\t" << A_Pair.second << endl;
return 0;
}
And the output
A_String: 20.9 33.4
A_ISS: 0xbfffe808
A_ISS.str(): 20.9 33.4
A_ISS After ReadA: 0xbfffe808
A_ISS.str() After ReadA: 20.9 33.4
A_ISS After ReadB: 0
A_ISS.str() After ReadB: 20.9 33.4
A and B: 20.9 0
Any ideas as to what is wrong???
Thanks,
Jeff