By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,469 Members | 1,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,469 IT Pros & Developers. It's quick & easy.

EOF

P: n/a
Hello NG,

Is EOF an actual character with an ASCII code, or is it an implicit
character?

Thanks,
Dave
Jul 22 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Dave wrote:
Hello NG,

Is EOF an actual character with an ASCII code, or is it an implicit
character?


That is system dependant.

I think most modern system now indicate eof when there is no more data
to be read.

Earlier systems (like cpm and msdos) had a ^Z character to indicate end
of file.
Jul 22 '05 #2

P: n/a
Dave wrote
:
Hello NG,

Is EOF an actual character with an ASCII code, or is it an implicit
character?

No it is not part of ASCII code, it is a convention, the numeric value
returned/accepted by functions indicating that the end of a file is reached.
It is usually -1.


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #3

P: n/a
Ioannis Vranos wrote:
Dave wrote
:
Hello NG,

Is EOF an actual character with an ASCII code, or is it an implicit
character?


No it is not part of ASCII code, it is a convention, the numeric value
returned/accepted by functions indicating that the end of a file is
reached.
It is usually -1.

And it's an *int*!

HTH,
--ag

--
Artie Gold -- Austin, Texas
http://it-matters.blogspot.com (new post 12/5)
http://www.cafepress.com/goldsays
Jul 22 '05 #4

P: n/a
Dave wrote:
Hello NG,

Is EOF an actual character with an ASCII code, or is it an implicit
character?

Thanks,
Dave


EOF is not part of the ASCII code, it is a value that
is outside the range of a character, which is why functions
that return EOF return an int, not a char.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library

Jul 22 '05 #5

P: n/a
On Sun, 23 Jan 2005 12:38:51 -0800 in comp.lang.c++, Gianni Mariani
<gi*******@mariani.ws> wrote,
Earlier systems (like cpm and msdos) had a ^Z character to indicate end
of file.


And all the way to current MS Windows systems. Likewise ^D indicates
end of file in some Unix contexts. However, that has no relation to
the C and/or C++ standard #define EOF

EOF is a special value returned from fgetc() etc. that specifically is
outside the range of values of a char.

Jul 22 '05 #6

P: n/a
David Harmon wrote:
On Sun, 23 Jan 2005 12:38:51 -0800 in comp.lang.c++, Gianni Mariani
<gi*******@mariani.ws> wrote,
Earlier systems (like cpm and msdos) had a ^Z character to indicate
end of file.


And all the way to current MS Windows systems. Likewise ^D indicates
end of file in some Unix contexts. However, that has no relation to
the C and/or C++ standard #define EOF

EOF is a special value returned from fgetc() etc. that specifically is
outside the range of values of a char.


It's also the return value of char_traits<char>::eof(), and as such plays an
important (but not very exciting) role in the C++ iostreams framework.

Jonathan
Jul 22 '05 #7

P: n/a
David Harmon wrote:
EOF is a special value returned from fgetc() etc. that specifically is
outside the range of values of a char.


It usually is, but that's not required. On a platform where int and char
have the same size, it wouldn't be possible to find an int value that is
not also a valid value for a char. That's why there is also the function
feof().
Jul 22 '05 #8

P: n/a
> >Earlier systems (like cpm and msdos) had a ^Z character to indicate end
of file.


And all the way to current MS Windows systems. Likewise ^D indicates
end of file in some Unix contexts. However, that has no relation to
the C and/or C++ standard #define EOF


It does have a relation, because some compilers generate an EOF when ^D or
^Z is encountered. The ASCII name for ^D is "End of transmission" and is
also used for indicating end of file on Macs.

Niels Dybdahl

Jul 23 '05 #9

P: n/a
> >Earlier systems (like cpm and msdos) had a ^Z character to indicate end
of file.


And all the way to current MS Windows systems. Likewise ^D indicates
end of file in some Unix contexts. However, that has no relation to
the C and/or C++ standard #define EOF


It does have a relation, because some compilers generate an EOF when ^D or
^Z is encountered. The ASCII name for ^D is "End of transmission" and is
also used for indicating end of file on Macs.

Niels Dybdahl
Jul 23 '05 #10

P: n/a
> >Earlier systems (like cpm and msdos) had a ^Z character to indicate end
of file.


And all the way to current MS Windows systems. Likewise ^D indicates
end of file in some Unix contexts. However, that has no relation to
the C and/or C++ standard #define EOF


It does have a relation, because some compilers generate an EOF when ^D or
^Z is encountered. The ASCII name for ^D is "End of transmission" and is
also used for indicating end of file on Macs.

Niels Dybdahl

Jul 23 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.