I have the following code which basically acts as a typewriter:
int main ()
{
char c;
puts ("Enter text:");
do {
c=getchar();
putchar (c);
} while (!feof(stdin));
return 0;
}
However when I feed it a text file for input: $ ./typewriter < input.txt
it always adds a ? at the end of the output. I'm not sure why this is happening, can anyone please point me to a reason why?
Thanks in advance!