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

ferror

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


Include

#include <stdio.h>

Signature & Overview

int ferror(FILE *stream);

Returns non-zero if the error indicator is set on stream.

Notes & Pitfalls

Example

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

int main(void) {
    FILE *f = tmpfile();
    assert(ferror(f) == 0);
    fclose(f);
}

Linked from

Related notes