No, it doesn't work.
cin.clear() clears the flag. But program still doesn't work.
This is a discussion on getline() for string within the C++ Programming forums, part of the General Programming Boards category; 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.
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.
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.Originally Posted by siavoshkc
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.