How's that needed in alexnb185's code? Wouldn't that just make the user press return or ctrl-D (or if they have a more interesting way of sending EOF...) before typing the name of the app? Reading into a large buffer with fgets() should virtually avoid the "flushing the buffer" problem. The buffer doesn't seem to be a problem in this case. The problem is the newline being read in by fgets(), which the couple of lines below the comment in the article I specified should take care of.

