mamy sobie kod:
unsigned int uid;
int wart;
istringstream ss;
string nowyuid = ctmp;
ctmp = strtok(0, "|");
string nowawart = ctmp;
ctmp = strtok(0, "|");
ss.str(nowyuid);
std::cout<<"ss.str()=="<<ss.str()<<std::endl ;
ss >> uid;
ss.str(nowawart);
std::cout<<"ss.str()=="<<ss.str()<<std::endl ;
ss >> wart;
std::cout << "nowy uid: " << nowyuid << " nowa wartosc: "
<< nowawart << endl;
std::cout << "nowy uid: " << uid << " nowa wartosc: "
<< wart << endl;
wszystko jasne raczej. wynik na konsoli:
ss.str()==9
ss.str()==0
nowy uid: 9 nowa wartosc: 0
nowy uid: 9 nowa wartosc: -1328570372
ktoś mi potrafi wyjaśnić jakim cudem instrukcja:
ss >> wart;
gdy zawartością ss jest "0" powoduje przypisanie do wart tego cholerstwa? :(
idę spać, dzięki za wszelkie podpowiedzi.