Philip McGraw on Fri, 18 Jan 2002 17:00:32 +0100


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

Re: [PLUG] EOF


I don't think the literal char code used in the file system
for marking EOF is even relevant here.  On the compilers and
systems I've checked, EOF gets #defined to be (-1) in stdio.h

This is merely the return code that getchar returns when it
encounters an end of file condition and has nothing to do with
how the file system determines where that end of file is.

Philip

On Fri, Jan 18, 2002 at 09:22:27AM -0500, paul@dpagin.net wrote:
> Thanks.  I'll pass that on.
> 
> I figured EOF is defined somewhere, but I wouldn't know where since I
> haven't done C programming in a while.  Anyway, I'm sure the information
> will be very useful.
> 
> 
> > On Fri, Jan 18, 2002 at 08:28:02AM -0500, paul@dpagin.net wrote:
> > > I'm using Linux to program C, however, when I try to do something like (
> > > c = getchar() ) != EOF
> > 
> > Have you tried using '^V^D' there instead of literally typing out
> > EOF? (That's control-V control-D. ^V makes the subsequent control
> > character visible.)
> > 
> > EOF is #defined in a system include somewhere which you're probably
> > not including in your source. Figuring out which include file would
> > also do the trick. (I never have because any time I've wanted to
> > check for the existence of EOF, I've also wanted to do more
> > complicated input processing and I've just linked against the GNU
> > readline library so I didn't have to think about it.)
> > 
> > > I can't input the EOF character ( which is "Ctrl + Z" under DOS ), I
> > > found in webs that "Ctrl + D" can do the job, but it doesn't work
> for me.
> > 
> > ^Z for EOF? That's totally crazy. ^D is the Unix (and POSIX, and
> > ISO, and...) standard key sequence to enter EOF. But it may or may
> > not work under Windows. (Gee, there's a shocker. ;^>)
> > 
> > Fwiw, I'm pretty sure ^D dtrt under Mac OS, even before Mac OS X, as
> > long as you're not using an application that chooses to catch and
> > interpret it itself. But I haven't checked lately.
> 
> 
> ______________________________________________________________________
> Philadelphia Linux Users Group       -      http://www.phillylinux.org
> Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce
> General Discussion  -  http://lists.phillylinux.org/mail/listinfo/plug

-- 

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
MartNet InterNet Services             99.9% pure       http://www.martnet.com

______________________________________________________________________
Philadelphia Linux Users Group       -      http://www.phillylinux.org
Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce
General Discussion  -  http://lists.phillylinux.org/mail/listinfo/plug


  • Follow-Ups: