Introduction
Today's lesson explains the fundamentals of file
Input/Output. File I/O is used to represent the many
different input and output operations that can be
performed on a file, such as reading from the file
or writing to the file. Accesing data via file I/O
is like reading a book. File I/O follows a sequence
events. The first step is to locate the file you want
to use. The second step is to open the file. When
you are done with the file, you close it.
|
File I/O operations such as reading
or writing can be done only on an open file. |
Three file types exist: sequential, random, and binary.
Sequential access is the simplest file access, but
is slow and cumbersome. Random access is a much faster
and more useful method of access.
|
The programs that use random-access
files are often more complex than sequential access
programs. |
Binary files are special, compacted forms of random-access
files.
|