GEOS SDK TechDocs
|
|
5 Files
|
5.2 Files and File Handles
Most file systems have a simple convention of what a file is. Applications treat files as if they were a sequence of bytes. They can read the bytes in order from the file, copying a sequence of bytes into memory. They have a "position" in the file, indicating the next byte to be read. An application can copy data from memory to a file, replacing the data there.
GEOS allows geodes to access any type of DOS file using the normal DOS conventions. However, it also provides its own file format, the GEOS file. GEOS files are stored on the disk as normal DOS files. This means that they can be copied from one disk to another by any normal DOS procedure; they can be uploaded or downloaded, compressed, archived, or transferred to different devices exactly as if they were ordinary DOS files. Nevertheless, when a system is running GEOS, the files have added functionality. GEOS data files have special extended attributes , which keep track of such things as the file's tokens, protocol numbers, etc. For more information about extended attributes, see GEOS Extended Attributes .
Most GEOS data files are Virtual Memory files. VM files can automatically back up data; they allow their users to insert data at any point in the file, and when the file's user needs access to data the VM manager automatically allocates memory and swaps the data into it. These files are created and accessed using special VM routines; for more information, see the VM chapter. Note that you can have a GEOS file hold raw data instead of having VM capability. Such a file is known as a "byte" file since it is treated as a sequence of bytes with no structure except what is specifically added by the file's creator. All of the routines for working with DOS files can be used with GEOS byte files.
One basic difference between GEOS files and DOS files is in naming conventions. Each file system and disk-operating system has its own convention for how files may be named. By far, the most common convention is the one used by MS-DOS: each file is identified by a name of up to eight characters, followed by an optional extension of up to three characters. There are further restrictions on which characters may be part of a name; for example, none of the characters may be a period.
GEOS provides more versatility. Each file has two different names. It has a native name; this is the name used by the device holding the file and must meet all of its restrictions. For example, if the file is kept on a usual DOS-compatible disk, the native name would be in the FILENAME.EXT format. The other name is the virtual file name. This may contain a number of characters equal to FILE_LONGNAME_LENGTH and may contain any characters other than backslashes ("\"), colons (":"), asterisks ("*"), and question marks ("?"). Any time a file's name is needed, either the virtual or the native file name may be used. When a file is created, GEOS automatically maps its virtual name into an appropriate native name.
Special GEOS information, such as the file's virtual name and extended attributes, is stored in the body of the file itself. Thus, while applications should not access this information directly, they can still be assured that it will be preserved when the file is copied by any normal DOS techniques. This information is stored in a special header which is transparent to geodes. If you use one of the bytewise file operations, you will not be able to affect the header.
GEOS SDK TechDocs
|
|
5 Files
|
5.2 Files and File Handles