Jump to content

End-of-file

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 49.206.209.129 (talk) at 07:23, 14 May 2020 (EOF character). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computing, end-of-file (commonly abbreviated EOF[1]) is a condition in a computer operating system where no more data can be read from a data source. The data source is usually called a file or stream.

In the C Standard Library, the character reading functions such as getchar return a value equal to the symbolic value (macro) EOF to indicate that an end-of-file condition has occurred. The actual value of EOF is implementation-dependent (but is commonly -1, such as in glibc[2]) and is distinct from all valid character codes. Block-reading functions return the number of bytes read, and if this is fewer than asked for, then the end of file was reached or an error occurred (checking of errno or dedicated function, such as ferror is often required to determine which).

1

See also

References

  1. ^ Wayne Pollock. "Shell Here Document Overview". hccfl.edu. Archived from the original on 2014-05-29. Retrieved 2014-05-28.
  2. ^ https://www.gnu.org/software/libc/manual/html_mono/libc.html#EOF-and-Errors