Chapter 25. File I/O

Table of Contents

25.. Motivation
25.. Filesystem Structure
25.. C File Streams
fopen() and fclose()
Stream Read Functions
Stream Write Functions
Example Program
25.. C Low-level I/O
open() and close()
25.. Fortran File Operations
Open and Close
25.. File Format Standards
25.. Code Quality
25.. Performance
Code Examples
25.. Self-test


Files are used for two main reasons:

  • Long term storage: To store data while the programs that use is are not running.
  • Short-term storage: To store temporary data that is too big for an, or is not accessed often enough to warrant keeping it in an array.