Step Into Labs

Step Into C · Lesson 20 · Systems C

Files & I/O

FILE *, fopen modes, error handling, reading lines, parsing, and binary files.

Part of Step Into C. The full lesson, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.

Reading configuration, parsing a log, loading a binary blob: sooner or later every program touches files. The C standard library gives you streams, represented by a FILE *. You already used three of them without opening anything: stdin, stdout and stderr.

In this lesson

Missions

  1. Read a file line by line
  2. When opening fails
  3. Parse a CSV
  4. Write, then read back
  5. Binary records