On this page
  1. feof
  2. Include
  3. Signature & Overview
  4. Notes & Pitfalls
  5. Example

feof

Prev: fflush | Up: stdio.h | Next: ferror
Rel: stdio.h, stdio.h & File I/O Guide
Ref: cppreference — feof
Tags: #public #prog #c #stdlib #stdio #tier/standard


Include

#include <stdio.h>

Signature & Overview

int feof(FILE *stream);

Returns non-zero if the end-of-file indicator has been set by a previous failed read.

Notes & Pitfalls

Example

#include <assert.h>
#include <stdio.h>

int main(void) {
    FILE *f = tmpfile();
    char buf[8];
    assert(fgets(buf, sizeof(buf), f) == NULL && feof(f));
    fclose(f);
}

Linked from

Related notes