EOF

D

Dave

Hello NG,

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

Thanks,
Dave
 
I

Ioannis Vranos

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.
 
G

Gianni Mariani

Dave said:
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.
 
A

Artie Gold

Ioannis said:
Dave wrote
:




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
 
T

Thomas Matthews

Dave said:
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
 
D

David Harmon

On Sun, 23 Jan 2005 12:38:51 -0800 in comp.lang.c++, Gianni Mariani
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.
 
J

Jonathan Turkanis

David said:
On Sun, 23 Jan 2005 12:38:51 -0800 in comp.lang.c++, Gianni Mariani


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
 
R

Rolf Magnus

David said:
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().
 
N

Niels Dybdahl

Earlier systems (like cpm and msdos) had a ^Z character to indicate end
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
 
N

Niels Dybdahl

Earlier systems (like cpm and msdos) had a ^Z character to indicate end
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
 
N

Niels Dybdahl

Earlier systems (like cpm and msdos) had a ^Z character to indicate end
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,199
Messages
2,571,045
Members
47,643
Latest member
ashutoshjha_1101

Latest Threads

Top