Computer Science: A Structured Programming Approach Using C 1 3-3 Converting File Type A rather common but somewhat trivial problem A rather common but somewhat trivial problem is to convert a text file to a binary file and vice is to convert a text file to a binary file and vice versa. C has no standard functions for these versa. C has no standard functions for these tasks. We must write a program to make the tasks. We must write a program to make the conversion. We describe the file conversion conversion. We describe the file conversion logic in this section. logic in this section. Creating a Binary File from a Text File Creating a Text File from a Binary File Topics discussed in this section: Topics discussed in this section:
13-3 Converting File Type. A rather common but somewhat trivial problem is to convert a text file to a binary file and vice versa. C has no standard functions for these tasks. We must write a program to make the conversion. We describe the file conversion logic in this section. - PowerPoint PPT Presentation
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Computer Science: A Structured Programming Approach Using C 1
13-3 Converting File Type
A rather common but somewhat trivial problem is to A rather common but somewhat trivial problem is to convert a text file to a binary file and vice versa. C has convert a text file to a binary file and vice versa. C has no standard functions for these tasks. We must write a no standard functions for these tasks. We must write a program to make the conversion. We describe the file program to make the conversion. We describe the file conversion logic in this section.conversion logic in this section.
Creating a Binary File from a Text FileCreating a Text File from a Binary File
Topics discussed in this section:Topics discussed in this section:
Computer Science: A Structured Programming Approach Using C 2
FIGURE 13-14 Create Binary File Structure Chart
Computer Science: A Structured Programming Approach Using C 3
PROGRAM 13-5 Text to Binary Student File
Computer Science: A Structured Programming Approach Using C 4
PROGRAM 13-5 Text to Binary Student File
Computer Science: A Structured Programming Approach Using C 5
PROGRAM 13-5 Text to Binary Student File
Computer Science: A Structured Programming Approach Using C 6
PROGRAM 13-5 Text to Binary Student File
Computer Science: A Structured Programming Approach Using C 7
PROGRAM 13-5 Text to Binary Student File
Computer Science: A Structured Programming Approach Using C 8
PROGRAM 13-5 Text to Binary Student File
Computer Science: A Structured Programming Approach Using C 9
FIGURE 13-15 Design for Print Student Data
Computer Science: A Structured Programming Approach Using C 10
PROGRAM 13-6 Print Student Data
Computer Science: A Structured Programming Approach Using C 11
PROGRAM 13-6 Print Student Data
Computer Science: A Structured Programming Approach Using C 12
PROGRAM 13-6 Print Student Data
Computer Science: A Structured Programming Approach Using C 13
PROGRAM 13-6 Print Student Data
Computer Science: A Structured Programming Approach Using C 14
PROGRAM 13-6 Print Student Data
Computer Science: A Structured Programming Approach Using C 15
PROGRAM 13-6 Print Student Data
Computer Science: A Structured Programming Approach Using C 16
PROGRAM 13-6 Print Student Data
Computer Science: A Structured Programming Approach Using C 17
PROGRAM 13-6 Print Student Data
Computer Science: A Structured Programming Approach Using C 18
13-4 File Program Examples
This section contains two common file applications. This section contains two common file applications. The first uses the file positioning functions to The first uses the file positioning functions to randomly process the data in a file. The second merges randomly process the data in a file. The second merges two files.two files.
Random File ProcessingMerge Files
Topics discussed in this section:Topics discussed in this section:
Computer Science: A Structured Programming Approach Using C 19
PROGRAM 13-7 Random File Application
Computer Science: A Structured Programming Approach Using C 20
PROGRAM 13-7 Random File Application
Computer Science: A Structured Programming Approach Using C 21
PROGRAM 13-8 Random File: Build File
Computer Science: A Structured Programming Approach Using C 22
PROGRAM 13-8 Random File: Build File
Computer Science: A Structured Programming Approach Using C 23
PROGRAM 13-9 Random File: Sequential Print
Computer Science: A Structured Programming Approach Using C 24
PROGRAM 13-9 Random File: Sequential Print
Computer Science: A Structured Programming Approach Using C 25
PROGRAM 13-10 Random File: Random Print
Computer Science: A Structured Programming Approach Using C 26
PROGRAM 13-10 Random File: Random Print
Computer Science: A Structured Programming Approach Using C 27
FIGURE 13-16 File Merge Concept
Computer Science: A Structured Programming Approach Using C 28
ALGORITHM 13-1 Pseudocode for Merging Two Files
Computer Science: A Structured Programming Approach Using C 29
PROGRAM 13-11 Merge Two Files
Computer Science: A Structured Programming Approach Using C 30
PROGRAM 13-11 Merge Two Files
Computer Science: A Structured Programming Approach Using C 31
PROGRAM 13-11 Merge Two Files
Computer Science: A Structured Programming Approach Using C 32
PROGRAM 13-11 Merge Two Files
Computer Science: A Structured Programming Approach Using C 33
13-5 Software Engineering
Any file environment requires some means of keeping Any file environment requires some means of keeping the file current. The function that keeps files current is the file current. The function that keeps files current is known as known as updating. To complete our discussion of . To complete our discussion of files, we discuss some of the software engineering files, we discuss some of the software engineering design considerations for file updating. design considerations for file updating.
Update FilesSequential File UpdateThe Update Program DesignUpdate ErrorsUpdate Structure Chart and Logic
Topics discussed in this section:Topics discussed in this section:
Computer Science: A Structured Programming Approach Using C 34
FIGURE 13-17 Sequential File Update Environment
Computer Science: A Structured Programming Approach Using C 35
FIGURE 13-18 File Updating Example
Computer Science: A Structured Programming Approach Using C 36
FIGURE 13-19 Update Structure Chart
Computer Science: A Structured Programming Approach Using C 37