Flushing cin buffer.
Does anyone know how to flush the input buffer in C++? I was able to do it in C by fflush(stdin) in C I/O, but I could not find its counterpart in C++. I am using a lot of input operations in my file structures project and sometimes values which were previously inputted are inputted again due to this problem.
Thanks for any help.
cin.flush does not exist. flush is an ostream member.
to do what you want try this...
you can call it like this....
void flush(istream & is)
that probably explains why i couldnt get it to work in my code?