Program logic and design chapter 7
Why are file sizes usually expressed in kilobytes
Because that byte is so small
Gigabytes
Billions of bytes
When discussing computer storage
Temporary permanent referred to volatility not length of time
Two broad categories of computer files
Text files, and binary files
What does .txt indicate
A plain text file
Kilobytes
Thousands of bytes
What is .jpg a file format for and what is its characteristics?
Used as an extension on image files in joint photographic experts group format.
delimiter
A character that separates data entries from one another.. comma, semicolon, or tab character.
An example of a filenames extension frequently designates the software that will be used to open a file
A file that uses the extension.docx Will usually be opened by Microsoft word by default
file name extension
A group of characters added to the end of a file name that describes the type of the file. For example the full name of the file might be JanuaryPayroll.txt in which the .txt is the file name extension.
Byte
A small unit of storage
filename
An identifying name given to a computer file that frequently describes the contents, for example JanuaryPayroll or previousMonthSales.
What is .dat extension
Common extension for data file
To use data files in your programs, you need to understand several file operations.
Declaring a file identifier, opening a file, reading from a file and processing the data, writing to a file, closing A file
Sorting in ascending order
Describes records sorted in order from lowest to highest values
Each file occupies space on a section of a storage device
Each file has a size. The sizes are measured in bytes.
Each file has specific times associated with it
Ex. It's creation time and the time it was last modified
What are some things Text files might include
Facts and figures used by business programs, such as payroll file that contains employee numbers, names, and salaries.
Although their contents vary, files have many common characteristics such as
Filename, and filename extension
records
Group of fields that go together for some logical reason. A random name, address, and salary aren't very useful but if they are your name, your address, and you're salary then that is your record.
Files
Groups of related records. The individual records of each student in your class might go together in a file card Students.DAT.
Database
Hold related file data in tables
An example of a byte
In a simple text file a byte holds only one character
Declaring a file identifier. Files are declared by giving each data type and identifier. examples
InputFile employeeData, OutputFile updatedData
characters
Letters, numbers, and special symbols, anything you can type from the keyboard even a space and tabs.
Megabytes
Millions of bytes
Directories and folders
Organization units on storage devices. Each can contain multiple files as well as additional directories
sequential file
Reads all the records in the file from beginning to end, processing them one at a time
Persistent Storage
Some programmers prefer this term instead of permanent storage. Because you can remove data from my files stored on a device such as a disc drive so it is technically not permanent. However the Daddo remains in the file even when the computer loses power so Unlike in RAM THE DATA PERSISTS
path
The combination of the disk drive plus the complete hierarchy of directories in which a file resides
Random Access Memory (RAM) or computer memory
Volatile, temporary storage that holds the program and data the CPU is presently processing. It is called temporary storage because its contents will be lost if electrical power to the computer is disrupted or the computer is turned off.
Close the file
When a program is finished using a file, it should do this. A close file is no longer available to your application
Data Hierarchy
When businesses store data items on computer systems, they are often stored in a framework called data hierarchy
Writing to the file
When you store data in a computer file on a persistent storage device
reading from a file
You never use the data values that are stored on a storage device directly. Instead you use a copy that is transferred into memory. When you copy data from a file on a storage device intoRAM you are "reading from a file"
computer file
a collection of data stored on a nonvolatile device in a computer system
Text files
contain data that can be read in a text editor because the data has been encoded using a scheme such as ASCII or Unicode
Binary files
contain data that has not been encoded as text. Examples include images and music.
permanent storage devices
hold nonvolatile data; examples include hard disks, DVDs, USB drives, and reels of magnetic tape
fields
lastName, middleInitial, streetAddress, or annualSalary
descending order
lists data in reverse alphabetical or sequential order. Highest to lowest values
Opening a file
locates the file on a storage device and associates a variable name within your program with the file