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

Re: Can't read stdin.



On Fri, Jul 19, 2002 at 10:24:03AM -0500, Chad C. Walstrom wrote:
> On Fri, Jul 19, 2002 at 07:36:37AM -0400, James Hughes wrote:
> > 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);
> > 
> > }
> 
> Not at all.  I added the following lines to your program:
> 
>     #include <stdio.h>
>     #include <stdlib.h>
> 
> And after your while loop, I added
>     
>     return EXIT_SUCCESS;
> 
  Did
> you forget the include headers?

No, I included stdio.h. If I hadn't the compiler would have complained
about the reference to EOF. This is really bizarre, I must say. 
btw, I'm running gcc 2.95.4; also, here is what glibc reports:

jhughes@jpath:$ /lib/libc.so.6
GNU C Library stable release version 2.2.5, by Roland McGrath et al.
Copyright (C) 1992-2001, 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 2.95.4 20011002 (Debian prerelease).
Compiled on a Linux 2.4.18 system on 2002-04-28.
Available extensions:
	GNU libio by Per Bothner
	crypt add-on version 2.1 by Michael Glad and others
	linuxthreads-0.9 by Xavier Leroy
	BIND-8.2.3-T5B
	libthread_db work sponsored by Alpha Processor Inc
	NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Report bugs using the `glibcbug' script to <bugs@gnu.org>.

I'm running sid.

Anybody? 

James

Attachment: pgpo3remOusqU.pgp
Description: PGP signature


Reply to: