Jump to content

End-of-file

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 203.192.233.62 (talk) at 09:16, 6 April 2017 (References). 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 general, the EOF is either determined when the reader returns null as seen in Java's BufferedReader,[2] or sometimes people will manually insert an EOF character of their choosing to signal when the file has ended.

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 system-dependent (but is commonly -1, such as in glibc[3]) and is unequal to any valid character code. 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. ^ Wayne Pollock. "Shell Here Document Overview". hccfl.edu. Archived from the original on 2014-05-29. Retrieved 2014-05-28. {{cite web}}: Unknown parameter |deadurl= ignored (|url-status= suggested) (help)
  2. ^ "BufferedReader". Oracle. Retrieved 28 February 2014.
  3. ^ https://www.gnu.org/software/libc/manual/html_mono/libc.html#EOF-and-Errors