/* Read in single line from "stdin": */
for( i = 0; (i < 80) && ((ch = getchar()) != EOF)
&& (ch != '\n'); i++ )
buffer[i] = (char)ch;
/* Terminate string with null character: */
buffer[i] = '\0';
printf( "%s\n", buffer );
}
-----------------
输入 abldkfkdfkfdkfd
就会输入同样的字符。。这是怎么回事。。因为getchar会检测是否到了字符串的尾巴(EOF)
----------------
Each of these functions returns the character read. To indicate an read error or end-of-file condition, getc and getchar return EOF