File I/O and Standard Library
Reading/writing files and the standard-library surface worth actually knowing.
The part of C that talks to the outside world instead of just moving values around in memory: opening files, reading and writing them, checking whether any of that actually worked, and the corners of <stdlib.h> worth actually knowing instead of looking up every time.
The four chapters
- A — File I/O Basics.
fopen/fcloseand the file-mode strings that decide read, write, append, binary, or some combination. - B — Reading and Writing.
fread/fwrite/fprintf/fscanf, and the buffering happening underneath that decides when data actually hits disk. - C — Error Handling.
errno,perror, and building the habit of checking return values that are extremely easy to just skip. - D — Standard Library Essentials. The parts of
<stdlib.h>that come up constantly — conversion functions,qsort, exit codes.
Where this lands in driver work
Userspace drivers talk to /dev and /sys nodes with exactly this file API — open/read/write on a device node is the same shape as fopen/fread/fwrite on a regular file, just at the syscall layer instead of buffered stdio. The error-checking discipline from Chapter C is non-negotiable there — a failed open() on a device node means something real went wrong with the hardware or permissions, not just a missing file.
File I/O Basics
fopen/fclose and file modes.
Reading and Writing
fread/fwrite/fprintf/fscanf and buffering behavior.
Error Handling
errno, perror, and checking return values that are easy to skip.
Standard Library Essentials
The parts of
Notes from readers
Comments — via GitHub