Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
File processing is the process of creating, storing and accessing content of files. File processing can be used in opening saved files for read only purpose. It can be used to save a new file or displace the existing one. Through file processing you can make new files and save the existing files. You can also modify files through this process. | Chapter 14 - File Processing Outline 14.1 Introduction 14.2 The Data Hierarchy 14.3 Files and Streams 14.4 Creating a Sequential-Access File 14.5 Reading Data from a Sequential-Access File 14.6 Updating Sequential-Access Files 14.7 Random-Access Files 14.8 Creating a Random-Access File 14.9 Writing Data Randomly to a Random-Access File 14.10 Reading Data Sequentially from a Random-Access File 14.11 Example: A Transaction-Processing Program 14.12 Input/Output of Objects 14.1 Introduction Storage of data Arrays, variables are temporary Files are permanent Magnetic disk, optical disk, tapes In this chapter Create, update, process files Sequential and random access Formatted and raw processing 14.2 The Data Hierarchy From smallest to largest Bit (binary digit) 1 or 0 Everything in computer ultimately represented as bits Cumbersome for humans to use Character set Digits, letters, symbols used to represent data Every character represented by 1's and 0's Byte: 8 bits Can store a . | Chapter 14 - File Processing Outline 14.1 Introduction 14.2 The Data Hierarchy 14.3 Files and Streams 14.4 Creating a Sequential-Access File 14.5 Reading Data from a Sequential-Access File 14.6 Updating Sequential-Access Files 14.7 Random-Access Files 14.8 Creating a Random-Access File 14.9 Writing Data Randomly to a Random-Access File 14.10 Reading Data Sequentially from a Random-Access File 14.11 Example: A Transaction-Processing Program 14.12 Input/Output of Objects 14.1 Introduction Storage of data Arrays, variables are temporary Files are permanent Magnetic disk, optical disk, tapes In this chapter Create, update, process files Sequential and random access Formatted and raw processing 14.2 The Data Hierarchy From smallest to largest Bit (binary digit) 1 or 0 Everything in computer ultimately represented as bits Cumbersome for humans to use Character set Digits, letters, symbols used to represent data Every character represented by 1's and 0's Byte: 8 bits Can store a character (char) Also Unicode for large character sets (wchar_t) 14.2 The Data Hierarchy From smallest to largest (continued) Field: group of characters with some meaning Your name Record: group of related fields struct or class in C++ In payroll system, could be name, SS#, address, wage Each field associated with same employee Record key: field used to uniquely identify record File: group of related records Payroll for entire company Sequential file: records stored by key Database: group of related files Payroll, accounts-receivable, inventory 14.2 The Data Hierarchy 1 01001010 Judy Judy Green Sally Black Tom Blue Judy Green Iris Orange Randy Red File Record Field Byte (ASCII character J) Bit 14.3 Files and Streams C++ views file as sequence of bytes Ends with end-of-file marker When file opened Object created, stream associated with it cin, cout, etc. created when included Communication between program and file/device 0 3 1 2 4 5 8 9 . . n-1 end-of-file marker