c++ cin question

From: Starkiller (starkiller_at_starkiller.org)
Date: 02/05/04


Date: Wed, 4 Feb 2004 22:51:00 -0600

Ok, I know that
std::cin.ignore(someint, '\n');
will ignore all the rest of the stream upto <=someint chars, or '\n' or
which ever comes first.

My question is is there a way to instruct cin to ignore everything currently
in the stream no matter how many chars it is? I mean completly reset the
stream. I thought std::cin.clear(); was my awnser but no luck there it keeps
the current stream if there isnt an error state.

thanks



Relevant Pages

  • Re: c++ cin question
    ... | in the stream no matter how many chars it is? ... 'INT_MAX' macro from, or preferably. ...
    (alt.comp.lang.learn.c-cpp)
  • Re: file access - design thoughts.
    ... But the stream can return an error state, because it does IO, and the ... mathematical functions is something that can very much do things too: ... In C you can say that a procedure is a void function. ...
    (comp.lang.c)
  • Re: Comments concerning TR 24731
    ... which are state information attached to each ... clear the error state for a stream, ... It is useful to be able to test ferror() to determine ...
    (comp.std.c)
  • Re: fstream problem
    ... I'm surprised that if you seekg to the ... That's the way standard I/O streams work: Once a stream is in error ... into error state, so that you can iterate through the file with a "while ... MVP - VC ...
    (microsoft.public.dotnet.languages.vc)
  • Re: fstream problem
    ... I'm surprised that if you seekg to the ... beginning of the file you have to clearto reset the eof and other ... That's the way standard I/O streams work: Once a stream is in error state ...
    (microsoft.public.dotnet.languages.vc)