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 <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>
<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
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>
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>
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>
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>
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>
¿Le ha llamado la atención una diapositiva en particular?
Recortar diapositivas es una manera útil de recopilar información importante para consultarla más tarde.