12 Years
Discussion Span
Last Post by Bench

You've heard of if / else statements haven't you?

Try using them:

if (good)
    //do stuff

elseif (bad)
     //ignore and carry on

yes of course i know the if statment.
there's an ignore function
ignore (.... , .... );
this function 2 ignore some data from the input stream.
u can choose 3 or 4 chars for example 2 ignore them . i'm asking how i can use it. with an example


ignore() is member of the istream class. It will ignore char stored in the input stream buffer. It is commonly used as part of an overall data validation process, but it can be used in other circumstance as well.

I agree, a better description/example of what the OP is trying to do will make it more apparent whether the istream ignore() method is what they want or whether they would be better writing a parsing algorhithm of sort, etc., as iamthwee initially suggested.


there's an ignore function
ignore (.... , .... );
this function 2 ignore some data from the input stream.

It looks like they mean the standard cin.ignore function.

Why do you need to ignore three chars? Do you want to flush the input buffer?


i found it
it's ignore(int,char)
the 1 st parameter is the number of inputs that 'll b ignored.
the 2nd is the char which the input will b ignored till this char.
which comes first.

in my program i used cin.ignore(100,'\n');
and so i ignored the rest of the line.

in fact i need 2 read the 1 st 3 inputs from each line and the rest of the line in neglected so i do the flowing:

int i,j,k;

it works good
each line i got the right inputs with neglecting the rest of the line.
my input stream is something like that:
6 8 9 khjgaguw gvmdvjfvnjnv sjbsdhkb.
8 66 0 b dbnfdhbfdjknbdmh9


what is the flash input buffer?
if u don't mind 2 explain for me

He said "Flush the input buffer" meaning empty all the data from the input stream.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.