Stringstream pb?

/*
Dear all,
i get different results for the following macro (see below).
if i compile it with g++ main.cxx, i get the expected output (1,2 and 3),
whereas running it within ROOT (with .x main.cxx), i get a truncated output, namely
only… 1,2
surely i am doing something wrong. in advance, many thanks for any hint.
my framework is based on SLC3 and i use
ROOT 5.06/00. / gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-54)
thanks, nabil.
*/

#include
#include
#include
using namespace std;

int main(){
string sa(“1 2 3”);
string ba;
stringstream ssa(sa);
while (ssa >> ba) cout << ba << endl;
return 0;
}

hi again,
the only solution i found so far is to add a dummy character at the end of the string i want to process.
namely i replace
string sa(“1 2 3”);
by
string sa(“1 2 3 END”);

But this is not the right approach. I did not try to move to a more recent ROOT/CINT version.
once more, thanks for any hint, about this problem.

Hi,

this is an issue with Cint’s handling of << - it doesn’t return the proper stream&. So instead do while (ssa) { ssa >> ba; cout << ba << endl; }
We hope to be able to address (some of) these issues with operators in the coming year.

Cheers, Axel.