InputMethod will return false. Then you need use some flag or status to tell the difference between EOF or error inside of while loop.
| Number and non-white character word | Character (including white-character) | string(line) |
C | scanf("%d %f %c %s",&i, &f,&c); | int a = getchar(); | fgets(stdin, char*p, n ) |
C++ | cin»i»f»c»w; | cin.get(char & c); | cin.get( char *p, n); |