So what about scanf("%*[^\n]%*c"); as fflush(stdin); ?
The students running linux had to use this command.
Windows students could pick which one they liked because the Borland compiler allowed it to.
So what about scanf("%*[^\n]%*c"); as fflush(stdin); ?
The students running linux had to use this command.
Windows students could pick which one they liked because the Borland compiler allowed it to.
Last edited by Enira; 03-11-2006 at 10:26 AM.
http://groups.google.com/group/comp....c2a8270de88382Originally Posted by Enira
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
WeirdOriginally Posted by Dave_Sinkula
DevC++ confirms this but my Borland does not.
In Borland it is just the same as a flush.
Anyway it can't hurt to seperate them knowing that it will decrease the rate of failing.
Last edited by Enira; 03-11-2006 at 11:55 AM.
I thought this little bitreally brought us full circle back to the FAQ.A tiny function that calls getchar() in a loop may be more readable to future programmers:
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
That's like saying "gets() works for me, most of the time".
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.