From ce0a78b6c6b4662c8b71bcbbc699dbaa0982a290 Mon Sep 17 00:00:00 2001 From: Kyler Date: Thu, 27 Nov 2025 20:10:12 -0700 Subject: [PATCH] Added links to toc --- docs/io_ref.md | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/docs/io_ref.md b/docs/io_ref.md index 61ef842..78f184e 100644 --- a/docs/io_ref.md +++ b/docs/io_ref.md @@ -14,20 +14,21 @@ A concise, practical reference for terminal (stdin/stdout/stderr) and file I/O i ## Table of contents -1. Overview -2. Streams and `FILE *` -3. Opening and closing streams -4. Formatted I/O (`printf`/`scanf` families) -5. Format specifiers and `inttypes.h` -6. Character I/O -7. Line and block I/O (`fgets`, `fputs`, `fread`, `fwrite`) -8. Buffering and `setvbuf` / `fflush` -9. File positioning (`fseek`, `ftell`, `rewind`) -10. Error handling (`feof`, `ferror`, `clearerr`, `perror`) -11. Temporary files -12. Tips for safe and portable terminal I/O -13. Examples -14. POSIX terminal control (note) +1. [Overview](#1-overview) +2. [Streams and `FILE *`](#2-streams-and-file) +3. [Opening and closing streams](#3-opening-and-closing-streams) +4. [Formatted I/O (`printf`/`scanf` families)](#4-formatted-io-printfscanf-families) +5. [Format specifiers and `inttypes.h`](#6-character-io) +6. [Character I/O](#6-character-io) +7. [Line and block I/O (`fgets`, `fputs`, `fread`, `fwrite`)](#7-line-and-block-io) +8. [Buffering and `setvbuf` / `fflush`](#8-buffering-and-setvbuf-fflush) +9. [File positioning (`fseek`, `ftell`, `rewind`)](#9-file-positioning) +10. [Error handling (`feof`, `ferror`, `clearerr`, `perror`)](#10-error-handling) +11. [Temporary files](#11-temporary-files) +12. [Tips for safe and portable terminal I/O](#12-tips-for-safe-and-portable-terminal-io) +13. [Examples](#13-examples) +14. [POSIX terminal control (note)](#14-posix-terminal-control-note) +15. [Quick reference: common functions](#15-quick-reference-common-functions) --- @@ -329,7 +330,7 @@ Example POSIX-only header include: --- -## Quick reference: common functions +## 15. Quick reference: common functions * `fopen`, `fclose` — open/close file * `fread`, `fwrite` — block I/O @@ -341,11 +342,3 @@ Example POSIX-only header include: * `fseek`, `ftell`, `rewind` — positioning * `feof`, `ferror`, `clearerr`, `perror` — error handling * `tmpfile`, `tmpnam` — temporary files - ---- - -If you want, I can: - -* Add a printable PDF / cheat-sheet version. -* Expand the POSIX terminal control section with a `termios` example. -* Create a one-page cheat-sheet for printing and scanning format specifiers.