Object-Oriented Programming for Windows 95 and NT

Chapter 13: Disk File Access

Overview

Most applications require access to disk files in one way or another programs that neither read data from disk nor allow new data to be saved are few and far between, and usually fairly pointless. The actual opening and closing of files, and saving of data, is handled by the standard instructions in each of the languages. However, Windows also has its own file-handling functions.

In addition, the user must be able to choose or enter a filename when opening or saving a file. The IDE gives the programmer varying degrees of help in setting up these standard tasks.

File Operations

All file operations must ultimately be carried out by a set of low-level routines that form part of the Windows operating system.

Before a file can be used, it must be opened. This operation prepares a file whether new or existing so that it can receive data, or data can be read from it. A transfer buffer is reserved in memory and the file is allocated a file handle. This handle is used in all subsequent operations to identify the handle.

Once opened, the file is available for reading and writing data. To the operating system any file is just a string or data bytes, with no particular structure. The structure must be imposed on the file by the applications. Essentially, files fall into two broad categories:

  • Sequential files are strings of individual bytes (e.g., text files), for which there are usually...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: File Compression Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.