Fundamental File Processing Operations

1,223 views

Published on

File Organization

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,223
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
25
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Fundamental File Processing Operations

  1. 1. Fundamental File Processing Operations Physical files and Logical files Opening files Closing files Reading and Writing Seeking Special Characters in Files
  2. 2. Physical Files and Logical Files <ul><li>Physical file </li></ul><ul><li>A file that actually exists on secondary storage. It is the file as known by the computer operating system and that appears in its file directory. </li></ul>
  3. 3. <ul><li>Logical Files </li></ul><ul><li>The file as seen by the program. The use of logical files allows a program to describe operations to be performed on a file without knowing what actual physical file will be used. The program may then be used to process any one of a number of different files that share the same structure. </li></ul>Physical Files and Logical Files
  4. 4. Opening Files <ul><li>2 ways of manipulation of files: </li></ul><ul><li>Open an existing file </li></ul><ul><li>Create a new file, deleting any existing contents in the physical file. </li></ul>
  5. 5. Closing Files <ul><li>Analogy </li></ul><ul><li>Telephone line, like hanging up the phone. When you hang up the phone, the phone is available for taking or placing another call; when you close a file, the logical file name or file descriptor is available for use with another file. Closing a file that has been used for output also ensures that everything has been written to the file. </li></ul>
  6. 6. Reading and Writing <ul><li>Fundamental to file processing </li></ul><ul><li>Actions that make file processing an input/output (I/O) operation. </li></ul>
  7. 7. Seeking <ul><li>The action of moving directly to a certain position in a file. </li></ul><ul><li>Requires at least two pieces of information, source file and offset. </li></ul><ul><li>Source file – the logical file name in which the seek will occur </li></ul><ul><li>Offset – the number of positions in the file the pointer is to be moved from the start of the file. </li></ul>
  8. 8. Special Characters in Files <ul><li>Creating a file structures may encounter some difficulty with extra, unexpected characters that turn up in the files, with characters that disappear, and with numeric counts that are inserted into the files. </li></ul>

×