CH13 - An Introduction to Programming with C Fifth Edition...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
An Introduction to Programming with C++, Fifth Edition 13 - 1 Chapter 13 Sequential Access Files At a Glance Instructor’s Manual Table of Contents Chapter Overview Chapter Objectives Instructor Notes Quick Quizzes Discussion Topics Classroom Activities/Additional Projects Key Terms
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
An Introduction to Programming with C++, Fifth Edition 13 - 2 Lecture Notes Chapter Overview This chapter will cover the basic concepts and implementation involved with sequential access files. Topics will include opening and closing, writing information to, reading information from, and testing for the end of sequential access files. Chapter Objectives After completing the chapter, the student will be able to: Open a sequential access file Determine whether a file was opened successfully Write data to a sequential access file Read data from a sequential access file Test for the end of a sequential access file Close a sequential access file Read information from and write information to a sequential access file in .NET C++ Instructor Notes File Types In addition to saving the C++ program instructions in a file, called a program file, you also can save input data in a file, called a data file. The information in a data file typically is organized into fields and records. A field is a single item of information about a person, place, or thing. A record is a group of related fields that contains all of the necessary data about a specific person, place, or thing. A data file is a collection of related records. In most programming languages, you can create three different types of data files: sequential, random, and binary. The data file type refers to how the data is accessed. The data in a sequential file is always accessed sequentially (in consecutive order). The data in a random file, on the other hand, can be accessed either in consecutive order or in random order. The data in a binary file access file can be accessed by its byte location in the file. This chapter only covers sequential access files.
Background image of page 2
An Introduction to Programming with C++, Fifth Edition 13 - 3 Using Sequential Access Files Since sequential files (also known as text files) are accessed in consecutive order, they can be considered similar to a cassette tape. Just like each piece of data in a sequential file must be accessed in consecutive order, each song on a cassette tape must also be accessed in consecutive order. To skip to the last piece of data in a sequential file, you must process through the data between where you currently are and the end of the file. The same is true with a cassette tape when you fast-forward to the last song on the tape. Sequential files have a definite advantage in that they are very easily created. The major disadvantage to sequential files goes back to the cassette tape analogy; they are processed in consecutive order regardless of how you would like them to be processed. Therefore, sequential files work best when you want to process either a small file (100 records or less), or a large file
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/11/2010 for the course CS 343 taught by Professor Katzman during the Spring '09 term at ITT Tech Tucson.

Page1 / 7

CH13 - An Introduction to Programming with C Fifth Edition...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online