istream::ignore()

Im having trouble doing with a but of code that seems to be syntactically correct but does not see to work the way I expected it to work. the snippet is below:

fin.ignore(INT_MAX, !(' ' && '\t'));

I'm trying to use this to ignore all characters in the line until it hits a character that is not a space or tab. If this is not allow could someone possible point me in the right direction with this issue?
try
 
||

instead of
 
&&


I didnt read the question right, sorry.
Last edited on
Yeah, that's not going to do what you want it to do.
What you have is basically equivalent to fin.ignore(INT_MAX, false);, which I suppose is probably the same as fin.ignore(INT_MAX, '\0');.

You could try something like this:
1
2
while (fin.peek() == ' ' || fin.peek() == '\t')
    fin.ignore();

This will discard characters as long as the next character is a space or tab.
Topic archived. No new replies allowed.