A terminal can sometimes be a little confusing. You must change your program to:
#include <stdio.h>
int main() {
int read;
while ((read = getchar()) != EOF) {
putchar(read);
}
return 0;
}
, getchar EOF ( -1) . getchar int, "read" , EOF. EOF Linux ^ D, , ^ Z (?).
, .
(read = getchar()) !='\n'
, '\n'. , , enter, '\n'.
, :
~$\a.out
(empty line)
getchar() , ,
f
. "F" , .
f
f~$
enter. "f\n". 'enter' , .
f , "\n" .
. , .