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



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'. The fault is that it doesn't check for EOF, which can lead to a fairly long wait.


--
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on
 "show options" at the top of the article, then click on the
 "Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
.



Relevant Pages

  • Wandering Monster dot com Flash site
    ... The toons should progress in chronological order from top to bottom rather than bottom to top -- I watched them in backwards order because I didn't realize I should start at the bottom. ... Voice clarity needs work, as it is hard for me to understand the characters all of the time. ... The writing needs a little work, too, although I'm not sure how much of this can be attributed to the voice clarity muffling the effectiveness of the jokes. ...
    (rec.games.frp.dnd)
  • A Note from the Site Creators
    ... of our site and characters. ... >should progress in chronological order from top to bottom rather than ... getting Kudos for Iris, make it the kind with chocolate chips. ... We plan to throw in a boatload of cameo monsters as well in the future. ...
    (rec.games.frp.dnd)
  • Re: Wandering Monster dot com Flash site
    ... of our site and characters. ... >should progress in chronological order from top to bottom rather than ... getting Kudos for Iris, make it the kind with chocolate chips. ... We plan to throw in a boatload of cameo monsters as well in the future. ...
    (rec.games.frp.dnd)
  • Re: Wandering Monster dot com Flash site
    ... of our site and characters. ... >should progress in chronological order from top to bottom rather than ... getting Kudos for Iris, make it the kind with chocolate chips. ... We plan to throw in a boatload of cameo monsters as well in the future. ...
    (rec.games.frp.dnd)
  • Re: Best way to control that compiler manage variable names longer then 8 signs.
    ... snip ... ... >> reasonable identifiers longer than 8 characters. ... the broken "Reply" link at the bottom of the article. ...
    (comp.lang.c)