Originally Posted by
ssharish2005
getchar() dosn't read from a file it reads from a standard input stream - keyboard -
ssharish2005
true but getchar() can still return EOF.
consider this example:
Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
int c;
while ( (c = getchar()) != EOF ) {
printf("%c", c);
}
}
if you call it using input redirection
Code:
testgetch < testgetch.c
>> what is the return value of getChar method when it is called after end of file has been reached ... as in it has once returned EOF and we call it again wht will be the value is it still EOF or an error condition is there
getchar() will continue to return EOF.
Kurt