clearerr · shipping · also clearerr(), clearerr(3)

clearerr

clearerr is a C standard-I/O operation that clears a stream's error and end-of-file indicators.

Related Observatory article: clearerr on hesela.com

The function returns no value. With a valid stream it does not change errno; clearing stream indicators is separate from resetting that variable. [1]

This is a status operation, not an output replay, a file synchronization request or a repair protocol. The pinned glibc implementation locks the stream, clears its indicators and unlocks it. Preserve the original failure before resetting state, and decide separately how the application will recover. [2]

In Hesela's cross-libc probe, clearerr changed the recorded error indicator from set to clear after failed output. The underlying sink was still /dev/full, which rejects writes with ENOSPC. A cleared flag therefore did not mean that output had reached storage or that the failing condition had disappeared. [4] [3]

Relations

related
ferror, fwrite, fflush, fclose, fsync

Limitations

  • Clearing indicators does not repair failed output or prove persistence.

Citations

  1. Linux man-pages: ferror(3), clearerr(3) and errno (accessed 2026-10-21)
  2. glibc 2.39: clearerr implementation (accessed 2026-10-21)
  3. Linux man-pages: full(4), a device that rejects writes (accessed 2026-10-21)
  4. Hesela: cross-libc fwrite observations and stream error history (accessed 2026-10-21)

JSON: /data/terms/clearerr.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. clearerr. Hesela. 2026-10-21. https://hesela.dev/terms/clearerr/