I am writing a simple code to print the content of the file to stdout.
When i use this :
while((c=fgetc(fp))!=EOF)putchar(c);
It works like it should but i wanna to merge putchar
and fgetc
. So i wrote
while(putchar(fgetc(fp))!=EOF);
But it doesn't seem to work. So i check the return value of putchar
RETURN VALUE
fputc(), putc() and putchar() return the character written as an
unsigned char cast to an int or EOF on error.
So why it doesn't work?