Chapter 26. File I/O

Table of Contents

26.. Motivation
26.. Filesystem Structure
26.. C File Streams
fopen() and fclose()
Stream Read Functions
Stream Write Functions
Example Program
26.. C Low-level I/O
open() and close()
26.. Fortran File Operations
Open and Close
26.. File Format Standards
26.. Code Quality
26.. Performance
Code Examples
26.. 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.