EOF?? 
Author Message
 EOF??



Quote:
>EOF means 'End Of File', so I thought the value of EOF would be changed
>by tht value of input. But I always got '-1'. Someone said it's
>consequential
>because it is defined as '-1' in <stdio.h>. Then.. what does
>'End Of File' really means?

EOF is a "magic value". You should never need to know its numeric
value and it has nothing to do with any end-of-file marker or data
stored in your files..

EOF is a value that is returned by I/O functions when they fail to
read any more data from the file, and the operating system tells them
that the file's end has been reached.

Mark McIntyre

C- FAQ: http://www.*-*-*.com/ ~scs/C-faq/top.html



Fri, 23 Aug 2002 03:00:00 GMT  
 EOF??
On Tue, 7 Mar 2000 01:28:54 +0900, "Lim Kyujung"

Quote:

>EOF means 'End Of File', so I thought the value of EOF would be changed
>by tht value of input. But I always got '-1'. Someone said it's
>consequential
>because it is defined as '-1' in <stdio.h>. Then.. what does
>'End Of File' really means?

EOF is a value that you compare to the return from some functions
(e.g., getc) to test end of file or an error has been detected.
EOF is a constant that does not change.  It must be negative, but
otherwise the value is up to the implementation.


Fri, 23 Aug 2002 03:00:00 GMT  
 EOF??
EOF means 'End Of File', so I thought the value of EOF would be changed
by tht value of input. But I always got '-1'. Someone said it's
consequential
because it is defined as '-1' in <stdio.h>. Then.. what does
'End Of File' really means?


Sat, 24 Aug 2002 03:00:00 GMT  
 EOF??

Quote:



> >EOF means 'End Of File', so I thought the value of EOF would be changed
> >by tht value of input. But I always got '-1'. Someone said it's
> >consequential
> >because it is defined as '-1' in <stdio.h>. Then.. what does
> >'End Of File' really means?

> EOF is a "magic value". You should never need to know its numeric
> value and it has nothing to do with any end-of-file marker or data
> stored in your files..

> EOF is a value that is returned by I/O functions when they fail to
> read any more data from the file, and the operating system tells them
> that the file's end has been reached.

In this way, the EOF in C differs from the EOF in Pascal, where it is
a function (returning a Boolean value, true or false) to tell you
whether a file (e.g. Standard Input) is positioned at its end.

This point is often confusing to people who have learned Pascal before
C.  Perhaps Lim Kyujung was thinking of the Pascal EOF function.

     - Rich



Sat, 24 Aug 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. When Is EOF not EOF?

2. Find eof without using EOF

3. EOF or not EOF

4. Detecting EOF

5. Unexpected behavior reading EOF in midstream

6. STDIN and EOF

7. EOF problem -- HELP!!

8. How do I read past EOF

9. TRUNCATE FILE: EOF?

10. EOF, getchar() and preprocessor portability issues (Re: O

11. EOF check

12. need some more help with fgets, stdin, EOF

 

 
Powered by phpBB® Forum Software