GEOS SDK TechDocs
|
|
5.1 DOS Files and GEOS Files
|
5.3 GEOS Extended Attributes
FileDuplicateHandle()
In order to read or change a file, you must open it with an appropriate routine. When you open a file, the file system sees to it that the file will not be erased or moved until you close it. When a geode exits, all files it has open are automatically closed. When GEOS exits, all files are closed. If an application restarts from a saved state, it will have to reopen all files.
When you open a file, the GEOS file system returns a
file handle
. This is a global handle associated with that file. Whenever you need to perform an action on a file you have opened, you specify the file by passing its handle. Note that there may be several handles which all refer to the same file. If more than one thread will need to use the same handle, they may synchronize their access by using
HandleP()
and
HandleV()
; for details, see the Memory Management chapter. The Virtual Memory routines include data-access synchronization routines for use with VM files; for details, see the VM chapter.
It is sometimes useful to have two different handles which indicate the same file. GEOS provides the routine
FileDuplicateHandle()
. This routine takes one argument, namely the handle of an open file. It creates and returns another handle which indicates the same file. You will have to close both handles to close the file.
FileDuplicateHandle()
works on any type of file handle; that is, it can be used on the handles of DOS files, GEOS byte files, or VM files. Note that the duplicate handle will have the same read/write position as the original.
GEOS SDK TechDocs
|
|
5.1 DOS Files and GEOS Files
|
5.3 GEOS Extended Attributes