Working with physical entities

The File System interface provides classes you can use to accomplish common tasks on physical entities. These tasks include:

Accessing file contents

A TFile instance is a handle to a physical file, but it does not provide access to a file's contents. To open a file, you instantiate a TFileStream or TMappedFile and access the contents using these instances. Both TFileStream and TMappedFile take TFile as a parameter and use this handle to establish file access.

A TFileStream instance acts as a named, persistent stream. A TMappedFile provides a mechanism for memory-mapped files. You cannot deep freeze either of these instances into a stream. You can, however, stream file system entities into streams with a deep-freeze level.

Deep freeze level
You can export any stream defined with freeze level of deep freeze to an address space not identical to the one in which you streamed in data. Whenever you stream out data, you should check the freeze level. If the stream is set to deep freeze, you must either be sure that all data you stream out remains valid regardless of the address space, or raise an exception when the items to stream include something only valid in the current address space.

"Accessing file system properties" on page 59 shows how to create a file stream and a mapped file.

Copying and moving files

TFileSystemCopier and TFileSystemMover provide the copy and move functions for files. See "Moving and copying file system instances" on page 62 for details of how to use these classes.

Iterating through volumes and directories

TVolumesIterator, TDirectoryIterator, TDirectoryTreeIterator, and TParentlessDirectoriesIterator each provide ways of iterating through physical entities. You can use these iterators in conjunction with property queries to retrieve file entities that match the characteristics you specify. "Iterating through directories and volumes" on page 64 provides several examples.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker