Fundamental File Processing Operations Physical files and Logical files Opening files Closing files Reading and Writing Seeking Special Characters in Files
Physical Files and Logical Files Physical file 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.
Logical Files 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. Physical Files and Logical Files
Opening Files 2 ways of manipulation of files: Open an existing file Create a new file, deleting  any existing contents in the physical file.
Closing Files Analogy 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.
Reading and Writing Fundamental to file processing Actions that make file processing an  input/output  (I/O) operation.
Seeking The action of moving directly to a certain position in a file. Requires at least two pieces of information, source file and offset. Source file – the logical file name in which the seek will occur Offset – the number of positions in the file the pointer is to be moved from the start of the file.
Special Characters in Files 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.

Fundamental File Processing Operations

  • 1.
    Fundamental File ProcessingOperations Physical files and Logical files Opening files Closing files Reading and Writing Seeking Special Characters in Files
  • 2.
    Physical Files andLogical Files Physical file 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.
  • 3.
    Logical Files Thefile 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. Physical Files and Logical Files
  • 4.
    Opening Files 2ways of manipulation of files: Open an existing file Create a new file, deleting any existing contents in the physical file.
  • 5.
    Closing Files AnalogyTelephone 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.
  • 6.
    Reading and WritingFundamental to file processing Actions that make file processing an input/output (I/O) operation.
  • 7.
    Seeking The actionof moving directly to a certain position in a file. Requires at least two pieces of information, source file and offset. Source file – the logical file name in which the seek will occur Offset – the number of positions in the file the pointer is to be moved from the start of the file.
  • 8.
    Special Characters inFiles 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.