Mark McIntyre <ma**********@spamcop.netwrites:
On 17 Jul 2006 23:48:16 -0700, in comp.lang.c , on********@gmail.com
wrote:
>>What would be the keyboard stroke for EOF?
EOF isn't a character, its a condition. How you generate it depends on
your operating system, but control-D and control-Z are popular
selections.
>>while((c=getchar())!=EOF) printf("%c",c);
what would cause the program to come out of the while loop?
Generating an EOF condition!
To be painfully precise, end-of-file is a condition; EOF is a macro,
expanding to a negative integer constant (typically -1), whose value
is returned by certain functions when an end-of-file condition (or an
error condition) is encountered.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.