delorie.com/archives/browse.cgi | search |
From: | horst DOT kraemer AT gmx DOT de (Horst Kraemer) |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: EOF |
Date: | Mon, 06 Nov 2000 15:57:34 GMT |
Lines: | 24 |
Message-ID: | <3a06c95c.2075534@news.cis.dfn.de> |
References: | <3a03ddb1$1 AT news DOT starhub DOT net DOT sg> |
NNTP-Posting-Host: | a1030.pppool.de (213.6.16.48) |
X-Trace: | fu-berlin.de 973529745 910670 213.6.16.48 (16 [27606]) |
X-Newsreader: | Forte Free Agent 1.11/32.235 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
On Sat, 4 Nov 2000 17:58:06 +0800, "Michelle" <neohkl AT cyberway DOT com DOT sg> wrote: > > What is EOF char for me? EOF is *not* a char. It is a negative *int* #defined in the header <stdio.h>. While the implementation will change from implementation (it is usually defined as -1) the meaning is independent and you don't need to know the value. EOF will be returned by fgetc and similar functions to indicate that you tried to read beyond end-of-file. Not that in order to compare the return value of fgetc etc. to EOF you have to assign it to an *int*. int c; /* !!! */ ... while ((c=fgetc(p)) != EOF) .... Regards Horst
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |