gabriel rosenkoetter on Fri, 18 Jan 2002 15:00:21 +0100


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

Re: [PLUG] EOF


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.

Cheers...

-- 
gabriel rosenkoetter
gr@eclipsed.net

Attachment: pgpfv7lEDzRev.pgp
Description: PGP signature