Chapter 6 Key Terms Flashcards
Types of Files
Text Files contain data that is encoded as text. Binary files contain data that has not been converted to text.
Sequential Access
A method of accessing data in a file where data is written or read from the beginning to the end.
Direct Access
A method of accessing data in a file where data can be read or written at any location within the file.
Filename
Is used to identify and locate a specific file within a directory or folder.
Filename Extensions
Suffixes added to filenames to indicate the file’s format or type.
File Object
Object associated with a specific file.
open Statement
Statement used in many programming languages to open a file for reading or writing.
Syntax for Opening a File
The syntax for opening a file consists of the open statement followed by the filename and mode in which the file should be opened.
mode
Specifies the purpose for which a file is opened.
‘r’
Read mode (default). Opens the file for reading.
‘w’
Write mode. Opens the file for writing.
‘a’
Append mode. Opens the file for writing.
write Statement
Used to write data to an open file. Allows for modification of content within a file.
Syntax for Writing to a File
The syntax for writing to a file involves using the file object’s ‘write’ method.
read Statement
Used to read data from an open file. Allows for the retrieval of content from a file and store it in a variable or display it.