Re: What's the guideline for dealing with unwanted chars in input stream?



Chuck F. said:

> Richard Heathfield wrote:
>> lovecreatesbeauty said:
>>
> ... big snip ...
> >
>>> 19
>>> 20 /* remove unwanted chars in input stream here now */
>>> 21 while(getchar() != '\n'); //intended null loop body
>>
>> This won't work, because it will keep reading and discarding
>> characters up to AND INCLUDING the first non-newline, which is
>> presumably supposed to be data.
>
> Hunh? It will remove chars from the stream, including the '\n'.

Oops. My apologies. I read it as == for some reason.


--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.



Relevant Pages

  • Re: A CHALLENGING problem
    ... I wasn't aware of the fact that Richard Heathfield once oppressively ... Dear "cturtle", here are some suggestions for you: ... snip portions of quoted text that are non-germaine to your ... welcome to clc: http://www.ungerhu.com/jxh/clc.welcome.txt ...
    (comp.lang.c)
  • Re: coderwiki.com is starting and needs you!
    ... Richard Heathfield wrote: ... My apologies to any chappesses in the group. ...
    (comp.lang.c)
  • Re: New non-cryptograhic hash function(s)
    ... Richard Heathfield wrote: ... C99 provides a bool type with ... expression, not a _Bool expression. ...
    (comp.programming)
  • Re: dynamically allocate array variable of type LPWSTR
    ... Richard Heathfield wrote: ... expression being assigned to is complex and one would rather not repeat ... it within the malloc, so ignore the fact that one would much prefer ...
    (comp.lang.c)
  • Re: inline vs macro
    ... Richard Heathfield wrote: ... time to get a new compiler. ... shall be as if they had *never* been part of the standard library headers. ...
    (comp.lang.c)