[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Can't read stdin.



Hello,

I became aware of the following problem while trying to 
compile and run some simple flex examples. Flex generates a 
macro, YY_INPUT, which uses getc() to read characters from 
stdin. All the examples I tried would crash on this getc() call.
I replaced getc with fread(), fgetc(): same problem. The program
would hang as soon as I hit the enter key.

Then I compiled the following program, straight from page 17
of K&R's The C Programming Language:

int main(void)
{
   int c; 
   while ( (c = getchar()) != EOF) 
      printf ("You typed: %c\n", c);

}

The SAME problem: The cursor doesn't even advance to the next line
when I hit enter. 
Anyone out there ever seen anything like this?

James

Attachment: pgpF5jJ3u4BZ8.pgp
Description: PGP signature


Reply to: