Hi there,
I need to overload istream in this way:
it needs to get string, then it has to parse this string and get number - can be longer than long long,
and then save this number in another string, which I will give to class method.
So far so good, then I need to return fail bit if there is no digit or "-" at start, again thats alright.
But problem comes when I need to return characters which are not digits after sucesfull digits scan back to istream - no idea how to do this....
string num;
string a="1215";
//some operations// num="1215"; - thats okay
a="-12"; num="-12" - thats okay
a="sad5456";
//some operations// -> failbit - need to return those characters back to istream
a="45654sds";
//some operations// num="45654" - need to return "sds" back to istream
So how am I supposed to return characters back to istream?? tried putback cycle, but then there was some blank char at istream and it didnt read anything :(
Thanks for answer!