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

Re: Can't read stdin. [SOLVED]



On Fri, Jul 19, 2002 at 07:36:37AM -0400, James Hughes wrote:
> 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?

*sigh*
It suddenly occurred to me: you know, emacs terminals are pretty 
flaky sometimes. I wonder if that's the problem here?
Sure enough, I tried it in a regular console and it worked as expected.
*Why* I didn't try that first instead of polluting the list with
this stuff I don't know. Thanks to those who tried to help out.

James

Attachment: pgpEKUUyIDi2O.pgp
Description: PGP signature


Reply to: