I have a C program.
int main ()
{
if (getchar()!=EOF)
puts("Got a character");
else
puts("EOF");
}
What should I type into the stdin on the terminal to produce an EOF?
I have a C program.
int main ()
{
if (getchar()!=EOF)
puts("Got a character");
else
puts("EOF");
}
What should I type into the stdin on the terminal to produce an EOF?
In Windows, Control+Z is the typical keyboard shortcut to mean "end of file", in Linux and Unix it's typically Control+D.
To determine what the value of EOF is on your platform you can always just print it:
printf ("%i\n", EOF);
You can simulate an EOF with: