Fact-checked by Grok 2 weeks ago

End-of-file

In computing, the end-of-file (commonly abbreviated as EOF) is a condition indicating that no additional data can be read from a file or input stream, signaling the termination of available input to programs and applications. This mechanism ensures orderly processing of data sources, preventing indefinite reading attempts and enabling efficient resource management in file input/output operations. At the system level, particularly in POSIX-compliant environments, EOF is detected during low-level read operations when the file position reaches or exceeds the file's size, causing the read() function to return 0 (indicating zero bytes transferred) without transferring any data. For or FIFOs, EOF occurs if no has the pipe open for writing, similarly resulting in a return value of 0. This approach relies on the filesystem's knowledge of the file's length rather than an explicit marker byte, allowing files to grow dynamically without embedded terminators. In higher-level programming interfaces, such as those defined in the , EOF is represented by a macro in the <stdio.h> header that expands to a negative expression (typically -1) of type int, returned by input functions like fgetc(), getc(), and fscanf() to denote end-of-file or an input error. The standard specifies that these functions set an end-of-file indicator for the stream upon reaching EOF, which can be queried using feof(), while ferror() distinguishes actual errors from the EOF condition. For wide-character streams in <wchar.h>, a similar macro WEOF serves an analogous role as a wint_t not corresponding to any valid extended character. The EOF concept is integral to common programming patterns, such as loops that process files until EOF is encountered (e.g., while ((c = getc(stream)) != EOF) in C), but it requires careful handling to avoid pitfalls like distinguishing EOF from read errors or avoiding off-by-one issues in buffer processing. This standardization, originating in early C (ISO/IEC 9899:1990) and POSIX.1 (IEEE 1003.1-1988), promotes portability across Unix-like systems and ensures robust data handling in diverse computing environments.

Overview

Definition and Purpose

End-of-file (EOF) is a condition encountered during input operations indicating that no further data is available from a , , or . In the , EOF is defined as a negative macro, distinct from any valid , returned by input functions to signal this state or an error. POSIX systems describe it as an end-of-file indicator set on the when reading attempts yield no bytes. In most modern systems, EOF functions as a logical state rather than a specific data byte embedded in the file, allowing streams to represent the boundary between available data and exhaustion without altering the file contents. This distinguishes EOF from partial reads, in which an operation returns fewer bytes than requested due to buffering or device constraints but confirms some data was accessed, whereas EOF denotes zero remaining bytes. The purpose of EOF is to prevent infinite loops in sequential reading operations by providing a clear termination signal, ensuring programs halt input processing efficiently. It also facilitates completion signaling in , scripting, and interactive terminals, where EOF marks the end of transfer and prompts resource cleanup or exit. For instance, in sequential , reaching EOF triggers the closure of the read , avoiding continued attempts to extract nonexistent . Historically, early storage media like used physical markers, such as , to denote the end of a file.

Historical Development

The concept of end-of-file (EOF) originated in the 1960s with systems, where physical markers signaled the conclusion of . In these early storage media, a , a special short block of recorded (such as all zeros), which the detects to signal EOF, as defined in the American National Standard for Magnetic Tape Labels for Information Interchange (ANSI X3.27-1969). This hardware-detected marker allowed to halt reading without relying on software , a necessity for devices prevalent in mainframe computing. By the mid-1960s, some systems employed directory-based , such as block or byte counts, to delineate boundaries, shifting some EOF detection to software while retaining signals for tapes. This approach addressed the limitations of variable-length records on disk packs, marking an early transition from purely physical to metadata-driven EOF handling. The 1970s saw a move toward software-based markers in personal computing, exemplified by (Control Program for Microcomputers), released in 1974 by . used fixed 128-byte sectors for storage, padding shorter files and employing the Ctrl-Z character (ASCII 26, or 0x1A) as an explicit EOF delimiter to distinguish actual data from unused space. This convention arose from the system's inability to store precise byte-level lengths, relying instead on the marker to signal the end of text content. Early iterations of the (FAT) file system, introduced with in 1981, inherited the Ctrl-Z marker from for in text files, despite the directory now supporting exact byte counts. This ensured seamless operation with CP/M-derived applications, though subsequent versions like FAT12 and beyond prioritized the stored file length for EOF detection, rendering the marker optional and primarily a legacy artifact. Standardization in the late 1980s formalized EOF as a logical condition rather than a physical or explicit byte. The IEEE POSIX.1 standard (1988) defined EOF in functions like read() as a return value of zero bytes, indicating no further data without embedding markers in the file itself. Similarly, the ANSI X3.159-1989 (ISO C90) standard specified EOF as a distinct value (-1) returned by stream functions such as fgetc(), emphasizing software detection via return codes over stored indicators. Prior to the 1980s, EOF detection heavily depended on hardware signals, such as tape marks or block terminators, which became obsolete with the dominance of digital disk storage and precise length metadata. This evolution prioritized efficiency and portability in modern file systems, eliminating the need for physical or ad-hoc markers.

System-Level Implementations

Unix-like Systems

In Unix-like systems, end-of-file (EOF) is primarily signaled through terminal interactions and system calls rather than explicit markers in files. For terminal input, pressing Ctrl-D (ASCII control character 4, or EOT) at the beginning of a line generates an EOF condition on standard input, configurable via the stty command's eof setting, which defaults to ^D. This behavior is governed by the terminal driver's line discipline, where Ctrl-D flushes the input buffer and signals EOF without consuming a newline, distinguishing it from interrupt signals like Ctrl-C (SIGINT). To insert a literal Ctrl-D character instead of triggering EOF, users prefix it with Ctrl-V (the default lnext quote character under stty), allowing verbatim entry of control sequences. File handling in Unix-like systems avoids explicit EOF bytes, relying instead on kernel-level detection. The read() system call returns zero bytes when the file offset reaches or exceeds the file's size, as stored in the inode's st_size field, indicating EOF without any sentinel value in the data stream. Inodes manage file allocation by pointing to data blocks on disk; EOF occurs when no further blocks are allocated beyond the declared size, enabling sparse files where unwritten regions beyond EOF return zeros on read without physical storage. Shells like and Zsh interpret EOF on standard input during interactive sessions as a request to exit, closing the session gracefully unless the IGNOREEOF option is set (defaulting to allowing up to 10 consecutive EOFs in for safety). For example, the cat command, when reading from standard input or a file descriptor, terminates output upon detecting EOF via zero-byte reads, without requiring or processing any marker byte. standards ensure consistent EOF handling across systems, where functions like feof() query the stream's end-of-file indicator only after an I/O operation (such as fread()) attempts to read past the end, setting the flag if zero bytes are returned. A distinctive Unix feature is the ioctl(TIOCPKT) call on pseudoterminals, enabling packet mode where reads from the master side receive prefixed control bytes for special events from the slave side. As of 2025, EOF signaling integrates seamlessly with containerized environments like , where pipes between host processes and container stdin/stdout propagate EOF naturally upon closure of one end, supporting interactive tools and scripted workflows without modification. This contrasts briefly with Windows systems, which use an explicit Ctrl-Z () character for console EOF.

Windows and DOS Systems

In , text files employed an explicit end-of-file (EOF) marker using the Ctrl-Z character (ASCII 26, also known as ), a inherited from to indicate the logical end of content within files stored on file systems. This marker addressed limitations in CP/M's file allocation, where data was managed in fixed 128-byte records, often requiring padding with Ctrl-Z characters to fill incomplete records and denote the true file boundary beyond the physical allocation. Windows systems evolved from this DOS heritage, retaining Ctrl-Z as an EOF marker in console applications and text-mode file operations to ensure with legacy DOS software. In the Windows API, functions such as CreateFile and ReadFile detect EOF primarily through implicit means, where a successful ReadFile call returns zero bytes read when the file pointer reaches the end, without relying on explicit markers in modern binary or non-legacy text contexts. For sequential file access patterns, the FILE_FLAG_SEQUENTIAL_SCAN flag can be specified during CreateFile to optimize caching and I/O performance toward the end of the file, though it does not alter the core EOF detection mechanism. In console input handling within , pressing Ctrl+Z followed by Enter signals EOF to the running application, allowing the marker to be inserted mid-line unlike the immediate Ctrl+D equivalent, which terminates input without requiring a subsequent . On file systems, EOF is determined by the exact stored in the file record, eliminating the need for explicit markers like Ctrl-Z in standard operations; however, legacy compatibility modes, including support for 8.3 short filenames from the era, preserve Ctrl-Z handling in text-mode I/O to accommodate older applications. A distinctive feature in error reporting is the use of GetLastError() to return ERROR_HANDLE_EOF ( 38, or 0x26), which explicitly indicates that the end of the file has been reached during an I/O operation, providing developers with a clear condition for EOF beyond mere byte counts.

Other Operating Systems and Legacy Systems

In mainframe systems like IBM z/OS, end-of-file detection for sequential often relies on trailer , particularly in tape-based storage where EOF1 labels mark the conclusion of a dataset. For variable-length , the Record Descriptor Word (RDW) precedes each record to indicate its length, and EOF can be signaled by a zero-length block or the exhaustion of allocated extents in disk-based datasets. OpenVMS employs Record Management Services (RMS) to handle EOF, where the RABV_EOF flag in the Record Access Block positions the stream at the end of the file during operations like Connect. RMS returns the status code RMS_EOF upon attempting to read beyond the file's content, and for historical tape support, hardware end-of-file marks (such as tape marks) are recognized to denote the physical end of media. In and operating systems (RTOS), EOF handling varies due to resource constraints and lacks a universal standard marker. For instance, in with its +FAT file system layer, EOF is typically detected implicitly through buffer exhaustion during reads or application-defined timeouts in stream processing, rather than explicit markers. Similarly, Arduino environments, often using SD card libraries like SD.h, infer EOF from the file's predefined length or when no more bytes are available in the buffer. Legacy systems exhibit diverse approaches tied to their file structures. determines EOF based on the exact stored in the file header, reaching the end when the current position matches this allocated length without additional markers. In OS Classic (pre-OS X), the (HFS) treats both data and resource forks implicitly, with EOF defined by the fork's length field in the catalog file entry, allowing reads to terminate upon exhausting the specified extent.) Addressing contemporary gaps in IoT environments as of 2025, modern RTOS like detect EOF in flash storage through that accounts for wear-leveling algorithms, such as in LittleFS where entries and inode structures track valid extents despite physical block remapping.

File Representation Methods

Explicit EOF Markers

Explicit end-of-file (EOF) markers consist of dedicated byte sequences or characters deliberately inserted into the file's content to delineate the conclusion of valid , independent of the underlying 's . These markers provide a self-contained signal within the itself, allowing applications to detect the end without querying external attributes like . Common examples include the Control-Z character (ASCII 26, hex 1A) in legacy text formats and the "%%EOF" string in structured document files. In MS-DOS and its predecessor CP/M, text files traditionally concluded with a single Control-Z byte to indicate EOF, a practice rooted in the file allocation system's block-oriented structure where unused space was padded, and the marker signified the true content boundary. This approach ensured compatibility across programs that processed files as streams, treating the marker as the termination point even if the physical file extended further. Similarly, the Portable Document Format (PDF), defined in ISO 32000, mandates the "%%EOF" trailer as the final element, positioned within the last 1024 bytes to facilitate quick location during parsing and validation of the document's integrity. In mainframe environments, such as those using OS/MVS simulation in IBM z/VM, an explicit EOF marker of hex X'61FFFF61' identifies the end of OS-formatted data when specific conditions such as fixed-block or fixed-block spanned formats with a short block are met. These markers find application in legacy text files to maintain with older operating systems and tools that expect embedded signals rather than relying on file length indicators. In environments, particularly for delimited formats like or TSV on mainframes or legacy Unix systems, explicit markers may be appended to ensure reliable termination in scenarios where is unavailable or unreliable, such as tape archives or concatenated datasets. For instance, while RFC 4180 standardizes without requiring an explicit EOF—defining the end via the final record, optionally followed by a CRLF —certain tools and batch utilities insert custom markers like a trailing or byte to explicitly signal completion and prevent misinterpretation in automated workflows. The primary advantages of explicit EOF markers lie in their simplicity for fixed-record or stream-based systems, where detection requires no additional file system calls, and they offer a safeguard against truncation by allowing of the marker's presence. This self-describing nature proves useful in distributed or archival contexts, such as multi-volume tapes, where might be absent. However, these benefits come with notable drawbacks: markers consume extra storage space, albeit minimally (typically 1-6 bytes), and pose risks in data containing the sequence naturally, potentially causing premature file termination— a critical issue for or unstructured files where escaping the marker is impractical or undefined. In text-oriented systems like , the convention assumes the marker (Control-Z) rarely appears in content, but this assumption fails for , leading to challenges. Overall, explicit markers suit environments prioritizing embedded reliability over efficiency, contrasting with implicit detection methods that leverage file for space savings.

Implicit End-of-File Detection

Implicit end-of-file (EOF) detection relies on filesystem to determine the boundary of a file's content, rather than embedding a specific marker within the itself. In systems like , the is stored in the inode structure, which serves as the primary entry for each file in the directory. This size field specifies the exact number of bytes allocated to the file, allowing the operating system to infer EOF when a read operation reaches or exceeds this limit. For instance, the read() function returns zero bytes when the file offset is at or past the end of the file, signaling EOF without any in-file indicator. This metadata-driven approach extends to advanced filesystems such as APFS, where is recorded in the j_inode_val_t within the volume's , representing the logical size in bytes. APFS maps to physical using extents stored in a dedicated (OBJECT_TYPE_BLOCKREFTREE or file extent tree), where the end of the file is determined by the cumulative length of these extents, aligned to the container's block size. Similarly, in , a filesystem, metadata is maintained in inode structures, and snapshots propagate this EOF information through shared extents that are only duplicated upon modification, ensuring consistent boundary detection across versions without redundant . In streaming contexts like and sockets, implicit EOF detection operates through signaling mechanisms rather than fixed metadata. For Unix , when no processes have the pipe open for writing, the read() call returns zero bytes to indicate EOF. In TCP sockets, the sender issues a close() or shutdown() operation, which transmits a packet; upon receipt and acknowledgment, the receiver's subsequent read() returns zero, denoting the stream's end. The primary advantages of implicit EOF detection include storage efficiency, as it avoids dedicating space or bytes to explicit markers, and prevention of data pollution, since no special characters are inserted that could interfere with file content. This method also seamlessly accommodates files, where arbitrary byte values might otherwise mimic or conflict with embedded EOF signals. In distributed environments, such as CephFS, EOF is managed via object that records , even when is striped across erasure-coded pools for ; the metadata server (MDS) enforces boundaries during access, integrating with RADOS objects to reconstruct complete streams up to the specified size.

Programming Language Handling

In C and C++

In , the end-of-file (EOF) condition is handled primarily through the standard input/output library defined in <stdio.h>. The macro EOF, an integer constant with a negative value distinct from any possible value of type unsigned char (typically -1 but implementation-defined), is returned by character-oriented input functions such as getchar() and fgetc() to indicate that the end of the input stream has been reached or an error has occurred. These functions return the value as an int to accommodate the negative EOF while allowing representation of all possible character values (cast from unsigned char). The feof() function tests the end-of-file indicator for a given stream, returning a non-zero value if the indicator is set, which occurs only after an input operation attempts to read beyond the end of the file; it should be checked after a read attempt rather than to control loops preemptively. For block-oriented reads, the fread() function attempts to read a specified number of from a and returns the number of elements successfully read, which may be less than requested if the end-of-file is encountered or an error occurs. In such cases, the return value does not directly equal EOF; instead, programmers must use feof() to check for the end-of-file indicator or ferror() to detect errors, potentially consulting errno for specifics like EBADF (invalid ). This design allows fread() to handle partial reads gracefully without conflating EOF with byte counts. In C++, EOF handling builds on the C model but uses the object-oriented iostreams library, where streams maintain an internal state with bit flags including eofbit. The eof() member function of basic_ios (and derived classes like istream) returns true if eofbit is set in the stream's rdstate(), which input operations set upon reaching the end of the input sequence. Formatted input via operator>> or functions like std::getline() set eofbit when no more data is available; if no characters are extracted before EOF (e.g., reading an empty line at the end), they also set failbit, making the stream appear in a failed state via the stream's conversion to bool. Unlike C's feof(), which checks a post-read flag, C++'s eofbit is set during the failing read, and failbit provides additional failure indication without implying data corruption (unlike badbit). A key distinction is support for exceptions: if eofbit is included in the stream's exceptions() mask, setting it triggers an ios_base::failure exception. Best practices for EOF detection in both languages emphasize reading first and checking afterward to avoid off-by-one errors. In C, a common idiom for character-by-character processing is:
int c;
while ((c = getc(fp)) != EOF) {
    // process c as unsigned char
}
This loop terminates correctly on EOF, and feof(fp) can be used post-loop if needed to confirm the cause. In C++, the equivalent uses the stream's bool conversion:
char ch;
while (in.get(ch)) {
    // process ch
}
or, after a failed read, clear the EOF/ fail flags with in.clear() to allow further operations like seeking. Misusing eof() or feof() to control loops (e.g., while (!feof(fp))) is error-prone, as the flag is not set until after the read fails. Portability requires awareness that EOF must satisfy CHAR_MIN <= EOF <= -1 and cannot equal any unsigned char value, ensuring it remains distinguishable across implementations with varying character encodings. The C23 standard (ISO/IEC 9899:2024) refines stream state specifications for clearer behavior in error and EOF detection, enhancing consistency in modern environments without altering core semantics.

In Other Languages

In Python, file objects created via the built-in open() function handle end-of-file (EOF) by returning an empty string '' when the read() method is called after all data has been consumed, signaling that no further bytes are available. For standard input via sys.stdin.readline(), the method returns an empty string '' on EOF, such as via Ctrl+D on Unix-like systems or end of input in scripts. Java's I/O APIs detect EOF primarily through return values and exceptions in stream classes. The InputStream.read() method returns -1 to indicate that the end of the stream has been reached with no byte available. In higher-level classes like BufferedReader, the ready() method can pre-check availability by returning false if the underlying stream would block or if EOF has been reached, allowing developers to avoid blocking reads.) For non-blocking I/O in the New I/O (NIO) package, channels signal EOF through a ClosedChannelException when an operation is attempted on a channel that has been closed, typically after the peer signals end of stream. Scripting languages provide idiomatic EOF detection integrated with their input operators. In Perl, the diamond operator <> (which reads from files or standard input) returns undef upon reaching EOF, allowing loops like while (<>) to terminate naturally without explicit checks. The special variable $. (input line number) remains at the last line count but does not increment further, aiding in post-loop verification. Ruby's IO#eof? method explicitly queries whether the stream is at end-of-stream, returning true after all data is read, and supports repositioning via seek if needed before checking. In JavaScript using Node.js, the synchronous fs.read() function signals EOF when the bytesRead parameter in its callback equals 0, indicating no more data was transferred into the buffer. Other languages emphasize error-based EOF signaling for robustness. Go defines a constant io.EOF error, which reader implementations like bufio.Reader return directly from Read methods when no more input is available, ensuring callers can distinguish graceful end from other errors without wrapping. Rust's standard library uses std::io::ErrorKind::UnexpectedEof as a variant in io::Error for cases where EOF occurs prematurely during an operation expecting more data, such as in read_exact(), while a normal EOF in partial reads is handled via 0 bytes returned without error. In asynchronous contexts, such as Kotlin Coroutines, EOF is handled through flow completion signals rather than explicit markers; flows produced from I/O sources, like file channels, complete naturally when the underlying ends, propagating completion upstream without throwing exceptions unless an occurs.

Distinction from End-of-Line

The end-of-line (EOL) marker serves to terminate individual lines within a or , typically represented by a line feed (LF, ASCII 10) in systems or a carriage return followed by line feed (CRLF, ASCII 13 followed by 10) in Windows and environments. In contrast, the end-of-file (EOF) condition indicates the complete exhaustion of in the file or input , signaling to the reading that no further bytes are available, without embedding a specific marker character in the data itself. This distinction is fundamental in text processing, as EOL enables into lines, while EOF defines the boundary of the entire content. In input/output operations, the handling of EOL and EOF varies by mode. Text mode performs automatic translation of EOL sequences—for instance, converting a single LF to CRLF on output in Windows—to ensure platform compatibility, while preserving the detection of EOF as the stream's natural termination. Binary mode, however, treats both EOL markers and the file's end as opaque data bytes, performing no translations and relying solely on byte counts or stream closure for EOF detection. Relevant standards reflect this separation: RFC 4180 for comma-separated values (CSV) files mandates CRLF as the EOL delimiter between records but specifies no explicit EOF marker, with the final record optionally lacking a trailing CRLF, relying instead on the file's implicit end. Similarly, Unicode UTF-8 encoded files employ an implicit EOF determined by the data stream's termination, with the byte order mark (BOM, U+FEFF) being optional and serving only as an encoding signature at the file's beginning, not affecting EOF handling. A notable interaction appears in messaging under 5322, where CRLF delimits all lines in the header and body, and the message terminates via an EOF sequence following the last CRLF, without a dedicated terminator character beyond the data stream's end. Common pitfalls arise when processing text files that confuse these concepts, such as assuming the final line's EOL serves as EOF, which can result in omitting the last line's content if it lacks a trailing —leading to incomplete data extraction in tools like or , which process lines up to but not beyond the actual EOF. For instance, POSIX-compliant utilities expect lines to end with a newline but handle files gracefully even if the last line is incomplete, preventing data loss only if EOF is detected separately from EOL parsing.

Error Handling and Edge Cases

In file input/output operations, a zero-byte read can indicate either the end-of-file (EOF) condition or an underlying error, such as disk full or I/O failure, leading to potential misinterpretation by applications. In C, functions like fgetc() return EOF (typically -1) for both cases, necessitating explicit checks using feof() to confirm EOF and ferror() to detect errors. On Windows systems, ReadFile() returns zero bytes read for synchronous EOF without error, but asynchronous operations require GetOverlappedResult() to return false combined with GetLastError() yielding ERROR_HANDLE_EOF (code 38) to distinguish true EOF from other failures. Empty files present an immediate EOF scenario upon opening, where no data is available and the first read attempt returns zero bytes without setting the EOF flag initially in languages like C++. For instance, in C++, std::ifstream::eof() returns false on an empty file until a read operation fails, requiring developers to check the stream state or return value directly to handle this case robustly. Network interruptions can mimic EOF when a peer closes a connection, causing read() on systems to return zero bytes to signal no more data, even if the closure is abrupt due to timeouts or disconnections. Partial writes before EOF add complexity, as write() may output fewer bytes than requested due to resource limits or non-blocking mode, returning the actual count written rather than an error. Best practices for robust I/O emphasize always inspecting return values from read and write operations to differentiate EOF from transient errors, implementing retry logic only for recoverable conditions like network glitches while treating confirmed EOF as terminal. In C and C++, this involves looping until the full buffer is processed or EOF is verified via feof() post-read, avoiding reliance on EOF alone in loop conditions. For security, premature EOF in parsers, such as XML processors handling untrusted input, can enable injection attacks by truncating documents to bypass validation or trigger denial-of-service via resource exhaustion on malformed streams. Mitigation requires strict input validation, disabling external entity resolution in parsers (e.g., via disallow-doctype-decl features), and confirming complete document parsing before processing.

Applications in Streaming and Cloud Computing

In streaming protocols, the concept of end-of-file (EOF) extends beyond traditional files to signal the termination of data flows over networks. In , the END_STREAM flag set in a , such as a HEADERS or , indicates that no further will be transmitted on that stream, effectively serving as an EOF marker to close the logical channel while allowing multiplexing of other streams. Similarly, connections use a close (opcode 0x8) to initiate the closing handshake, notifying both endpoints of the stream's end and preventing further message exchange, which functions analogously to EOF in bidirectional streaming scenarios. In environments, EOF handling facilitates reliable data ingestion for large-scale storage. For multipart uploads, which support streaming of objects exceeding 5 GB, the process concludes with a CompleteMultipartUpload request that assembles parts using their part numbers and ETags—unique identifiers returned after each successful UploadPart operation—thus finalizing the stream and materializing the complete object. employs streaming uploads via , where the client signals EOF by appending a zero-length chunk (trailer with "0\r\n\r\n") after all data chunks, allowing the server to confirm completion without prior knowledge of the total size. Big data frameworks adapt EOF detection for distributed processing of partitioned data. In Apache Hadoop's HDFS, EOF is identified per block through the FSDataInputStream, which throws an EOFException when the read position reaches or exceeds the block's defined length, enabling seamless transitions between blocks during file reads. handles implicit EOF in partitions via management; consumers detect the end of available data when the committed aligns with the partition's high-water mark (log end ), signaling completion without explicit markers, while producers rely on acknowledgment callbacks for per-message finality. Ensuring EOF consistency across distributed presents challenges due to partitions and asynchronous processing. In such architectures, termination must propagate reliably; for instance, if one service signals EOF but another lags, inconsistencies arise unless coordinated via patterns like the orchestrator, which sequences compensating actions to reconcile partial states. models address this by allowing temporary divergences—such as delayed EOF acknowledgments—before all replicas converge on the final state through gossip protocols or event sourcing, prioritizing availability over immediate synchronization. In modern data pipelines as of 2025, EOF concepts support epoch delineation in streaming workflows. TensorFlow's tf.data API manages infinite streams from sources like generators via the .repeat() transformation, where epoch ends are implicitly defined by consuming a fixed number of steps_per_epoch batches before restarting, avoiding natural exhaustion while enabling controlled training loops over unbounded data.

References

  1. [1]
    read
    ### Summary: End-of-File Detection and Return Value in POSIX read()
  2. [2]
    [PDF] Chapter 15 File Input & Output
    An end of file condition exists when the final piece of data has been read from a file. Most of the functions from <stdio.h> return a special flag to indicate ...
  3. [3]
    [PDF] ISO/IEC 9899:yyyy - Open Standards
    C. Abstract. (This cover sheet to be replaced by ISO ...
  4. [4]
    EOF(3const) - Linux manual page - man7.org
    EOF represents the end of an input file, or an error indication. It is a negative value, of type int. EOF is not a character.
  5. [5]
    [PDF] ISO/IEC 9899:1999(E) -- Programming Languages -- C
    4. International Standard ISO/IEC9899 was prepared by Joint Technical. Committee ISO/IEC JTC 1, Information technology, Subcommittee SC 22,. Programming ...
  6. [6]
    fseek
    A successful call to fseek() shall clear the end-of-file indicator for the stream and undo any effects of ungetc() and ungetwc() on the same stream. After ...
  7. [7]
    fopen
    The fopen() function shall open the file whose pathname is the string pointed to by pathname, and associates a stream with it. The mode argument points to a ...
  8. [8]
    IBM 729 Tape Unit History & Info
    An interrecord gap, followed by a special single-character record known as a tape mark, is used to mark the end of a file of information. Reflective markers are ...
  9. [9]
    [PDF] magnetic tape labels - NIST Technical Series Publications
    1, Multivolume File. 5.13.2 The end-of-tape marker is recognized while the last data block in the file is being written. In.Missing: historical | Show results with:historical
  10. [10]
    RFC 354 - File Transfer Protocol - IETF Datatracker
    PDP-10's generally store NVT-ASCII as five 7-bit ASCII characters, left ... The descriptor code defines last file block (EOF), last record block (EOR) ...
  11. [11]
    Why do text files end in Ctrl+Z? - The Old New Thing
    Mar 16, 2004 · In CP/M, files were stored in “sectors” of 128 bytes each. If your file was 64 byte long, it was stored in a full sector. The kicker was that ...Missing: 1974 | Show results with:1974
  12. [12]
    Misconceptions on Top of Misconceptions | OS/2 Museum
    Jan 18, 2024 · While Ctrl-Z is listed as the end of file marker for CP/M, the read and write routines will cheerfully go right past any such marker. The ...Missing: 1974 | Show results with:1974
  13. [13]
    [PDF] IEEE standard portable operating system interface for computer ...
    IEEE Std 1003.1-1988 is the first of a group of proposed standards known col¬ loquially, and collectively, as POSIXt. The other POSIX standards are described in ...
  14. [14]
    [PDF] for information systems - programming language - C
    159-1989.) This standard specifies the syntax and semantics of programs written in the C programming language. It specifies the C program's interactions with ...
  15. [15]
    stty(1) - Linux manual page
    ### Summary: EOF Character and Ctrl-D in `stty`
  16. [16]
    read(2) - Linux manual page - man7.org
    If the file offset is at or past the end of file, no bytes are read, and read() returns zero. If count is zero, read() may detect the errors described below. In ...
  17. [17]
    4.1. Index Nodes — The Linux Kernel documentation
    In a regular UNIX filesystem, the inode stores all the metadata pertaining ... This file has blocks allocated past EOF (EXT4_EOFBLOCKS_FL). (deprecated).Missing: explicit | Show results with:explicit
  18. [18]
    bash(1) - Linux manual page - man7.org
    IGNOREEOF Controls the action of an interactive shell on receipt of an EOF character as the sole input. If set, the value is the number of consecutive EOF ...<|control11|><|separator|>
  19. [19]
    ioctl_tty(2) - Linux manual page - man7.org
    On success, 0 is returned. On error, -1 is returned, and errno is set to indicate the error. SEE ALSO top. ioctl(2) ...
  20. [20]
    86-DOS Revisited | OS/2 Museum
    Jan 15, 2024 · ... 128-byte records (ever wondered why text files used to end with ASCII SUB aka Ctrl-Z?). Perhaps file sizes were stored in units of 128-byte ...
  21. [21]
    CP/M and DOS use ^Z (0x1A) as an EOF indicator. More modern ...
    Mar 14, 2020 · CP/M and DOS use ^Z (0x1A) as an EOF indicator. ... It's not true, plenty of DOS programs stopped I/O operations with ctrl + z, and exited with ...Missing: history 1974
  22. [22]
    Testing for the End of a File - Win32 apps | Microsoft Learn
    Jan 7, 2021 · The ReadFile function checks for the end-of-file condition (EOF) differently for synchronous and asynchronous read operations.
  23. [23]
    ReadFile function (fileapi.h) - Win32 apps - Microsoft Learn
    Jul 22, 2025 · If the lpNumberOfBytesRead parameter is zero when ReadFile returns TRUE on a pipe, the other end of the pipe called the WriteFile function with ...Syntax · Parameters
  24. [24]
    How do FILE_FLAG_SEQUENTIAL_SCAN and ...
    Jan 20, 2012 · There are two flags you can pass to the CreateFile function to provide hints regarding your program's file access pattern.Missing: EOF | Show results with:EOF
  25. [25]
    Why do I require multiple EOF (CTRL+Z) characters? - Stack Overflow
    Apr 13, 2011 · EOF is not generated by Windows automatically when you type ^Z; it's just a convention carried over from DOS. The runtime of your C compiler ...character - Representing EOF in C code? - Stack OverflowWhy Ctrl-Z does not trigger EOF? - Stack OverflowMore results from stackoverflow.comMissing: history 1974
  26. [26]
    Equivalent to ^D (in bash) for cmd.exe? - Super User
    May 31, 2011 · No. Ctrl D on *nix generates a EOF, which various shells interpret as running exit. The equivalent for EOF on Windows is Ctrl Z.<|separator|>
  27. [27]
    How to process huge text files that contain EOF / Ctrl-Z characters ...
    Dec 20, 2013 · It's impossible on Windows, in any programming language, to open a file in text mode and not have Ctrl+Z treated as end-of-file. Tim Peters.Why Ctrl-Z does not trigger EOF? - Stack OverflowHow to Detect Ctrl-z End of File Marker in C Programming LanguageMore results from stackoverflow.comMissing: NTFS legacy 8.3
  28. [28]
    System Error Codes (0-499) (WinError.h) - Win32 apps
    Jul 14, 2025 · Too many files opened for sharing. ERROR_HANDLE_EOF. 38 (0x26). Reached the end of the file. ERROR_HANDLE_DISK_FULL. 39 (0x27).
  29. [29]
    Data set Trailer labels - IBM
    The block count field in the HDR1 label contains zeros (which is what the EOF1/EOV1 block count is reduced to when the data set is read backward). A data set ...
  30. [30]
    Data set record formats - IBM
    This format has one logical record as one physical block. A variable-length logical record consists of a record descriptor word (RDW) followed by the data. The ...Missing: detection trailer
  31. [31]
    [PDF] VSI OpenVMS Record Management Services Reference Manual
    This reference manual contains general information intended for use in any. OpenVMS programming language, as well as specific information on writing programs ...
  32. [32]
    File Systems - Zephyr Project Documentation
    Zephyr RTOS Virtual Filesystem Switch (VFS) allows applications to mount multiple file systems at different mount points (eg, /fatfs and /lfs).Missing: EOF detection wear- leveling
  33. [33]
    Does the %%EOF in a PDF have to appear within the last 1024 ...
    Aug 10, 2012 · PDF spec says %%EOF must be found within the last 1024 bytes of the file. We add an extra 30 characters to leave room for the startxref stuff.Fastest way to check that a PDF is corrupted (Or just missing EOF) in ...appending %%EOF to a PDF file in python - Stack OverflowMore results from stackoverflow.com
  34. [34]
    EOF is not a character - Hacker News
    Mar 14, 2020 · CP/M featured an explicit end of file marker because the file system didn't bother to handle the problem of files which were not block ...<|separator|>
  35. [35]
    End-of-file marker - IBM
    OS/MVS simulation uses the end-of-file (EOF) marker (X'61FFFF61') to identify the end of the OS data in a file when all of the following conditions are met.Missing: detection RDW trailer zero-
  36. [36]
    RFC 4180 - Common Format and MIME Type for Comma-Separated ...
    This RFC documents the format of comma separated values (CSV) files and formally registers the "text/csv" MIME type for CSV in accordance with RFC 2048.
  37. [37]
    Do files actually contain an End Of File (EOF) character? [duplicate]
    Aug 28, 2019 · If we look at what the POSIX standard says, there's no mention of an end-of-file character or marker for text files, just that they contain no ...Understanding sparse files, dd, seek, inode block structureWhat is a Superblock, Inode, Dentry and a File?More results from unix.stackexchange.comMissing: inode | Show results with:inode
  38. [38]
    CTRL-Z was never actually an End-Of-File character in MS-DOS.
    Character 26, CTRL-Z , is the End-Of-File (EOF) character in MS-DOS ... DOS makes no distinction between "text" files and "binary" files in its system API.Missing: ASCII | Show results with:ASCII
  39. [39]
    Ceph File System — Ceph Documentation
    ### Summary on EOF Detection in CephFS Using Object Metadata with Erasure Coding
  40. [40]
    [PDF] Ceph: A Scalable, High-Performance Distributed File System
    Ceph maximizes the separation between data and metadata management by replacing allocation ta- bles with a pseudo-random data distribution function. (CRUSH) ...<|separator|>
  41. [41]
    None
    Below is a merged summary of the EOF macro in the C11 Standard (N1570), consolidating all information from the provided segments into a concise yet comprehensive response. To retain all details efficiently, I will use a table in CSV format for key information (e.g., definition, value, usage, functions, and sections), followed by additional notes and URLs. This approach ensures maximum density while preserving all mentioned details.
  42. [42]
    feof
    The feof() function shall test the end-of-file indicator for the stream pointed to by stream. RETURN VALUE The feof() function shall return non-zero.
  43. [43]
    [PDF] ISO/IEC 9899:2024 (en) — N3220 working draft - Open Standards
    (This cover sheet to be replaced by ISO.) This document specifies the form and establishes the interpretation of programs expressed in the.
  44. [44]
    io — Core tools for working with streams — Python 3.14.0 ...
    The io module provides Python's main facilities for dealing with various types of I/O. There are three main types of I/O: text I/O, binary I/O and raw I/O.
  45. [45]
  46. [46]
    perlop - Perl expressions: operators, precedence, string literals
    undef is always treated as numeric, and in particular is changed to 0 before incrementing (so that a post-increment of an undef value will return 0 rather than ...
  47. [47]
    perlvar - Perl predefined variables - Perldoc Browser
    Variable names in Perl can have several formats. Usually, they must begin with a letter or underscore, in which case they can be arbitrarily long.5.8.5 · 5.6.0 · 5.005
  48. [48]
  49. [49]
  50. [50]
  51. [51]
  52. [52]
  53. [53]
    Text and Binary Mode File I/O - Microsoft Learn
    May 20, 2024 · File I/O operations take place in one of two translation modes, text or binary, depending on the mode in which the file is opened.Missing: EOL EOF
  54. [54]
  55. [55]
    [PDF] Clarify guidance for use of a BOM as a UTF-8 encoding signature
    Jan 2, 2021 · A BOM can be used as a UTF-8 signature in untyped data, but not when encoding is indicated. It's useful for files with unknown endian format.
  56. [56]
  57. [57]
  58. [58]
    FIO34-C. Distinguish between characters read from a file and EOF ...
    If the stream is at the end of the file, the end-of-file indicator for the stream is set and the function returns EOF . If a read error occurs, the error ...Missing: computing | Show results with:computing
  59. [59]
    write
    Every application should be prepared to handle partial writes when O_NONBLOCK is set and the requested amount is greater than {PIPE_BUF}, just as every ...
  60. [60]
    XML External Entity Prevention - OWASP Cheat Sheet Series
    An XXE attack occurs when untrusted XML input with a reference to an external entity is processed by a weakly configured XML parser.
  61. [61]
    RFC 9113 - HTTP/2 - IETF Datatracker
    A HEADERS frame with the END_STREAM flag set signals the end of a stream. However, a HEADERS frame with the END_STREAM flag set can be followed by ...HTTP/2 Protocol Overview · Starting HTTP/2 · Expressing HTTP Semantics in...
  62. [62]
  63. [63]
  64. [64]
  65. [65]
    Distributed transaction patterns for microservices compared
    Sep 21, 2021 · How to approach the dual write problem: A comparison of 5 patterns for coordinating dual writes in a microservices architecture.
  66. [66]
    Eventually Consistent - All Things Distributed
    This is an important model where process A after it has updated a data item always accesses the updated value and never will see an older value.Missing: EOF | Show results with:EOF
  67. [67]