Chapter 6 Flashcards
“Writing data to”
Saving data on file
Output File
A file that data is written to
“Reading data from”
The process of retrieving data from a file.
Input File
A file from which data is read
Three steps for using a file
Open, process, close
Sequential Access
A file is read sequentially from beginning to end.
Direct Access
Can jump to any piece of data in the file.
open Function
Opens a file
‘r’
Opens a file for reading only
‘w’
Opens a file for writing and erases its current content
‘a’
Opens a file for writing and adds it to the end, does not erase
Method
A function that belongs to an object
read Method
Reads the files entire content into memory
readline Method
Reads a single line
Read Position
Marks the location of the next item to be read