No, it doesn't work.
cin.clear() clears the flag. But program still doesn't work.
Printable View
No, it doesn't work.
cin.clear() clears the flag. But program still doesn't work.
What's your code? I doubt I can help you, but I at least want to try figuring it out. :)
My code is what i've posted plus a cin.clear() before cin.get(). I better go for your suggestion and use substr().
I don't know what I am doing tonight. After forgotting basic things. Now I see I placed the code in an infinite loop. The last problem was because of this. Thank you so much for your help. I didn't know about ctrl+z. Now I am using a string, a stream and rdbuf().
The only thing I don't know is how to copy a stream into another.
Thanks again.
What's wrong with the code in post #13?
I should be thanking you. I learned a lot by trying to find the answers to help. :)Quote:
Originally Posted by siavoshkc
It puts cin into another stream indirectky. Is it possible to do it directly?Quote:
What's wrong with the code in post #13?
Yes, with rdbuf, but you have to deal with finding the end of the stream issue. If you're fine with ctrl-z, then that's how you would do it.
And this is exactly what I am doing.