GEOS SDK TechDocs
|
|
3 Disks and Drives
|
3.2 Accessing Disks
DriveGetStatus(), DriveGetExtStatus(), DriveGetDefaultMedia(), DriveTestMediaSupport(), DriveGetName(), DriveStatus, DriveType, MediaType
Most systems running GEOS have access to a number of different drives. With the exception of network drives, the drives available will usually not change during an execution of GEOS, although the volumes mounted on the drives can change. Every drive is accessed by its drive number . This token is a byte-length integer value.
When you wish to open a file, you must specify its volume, not its drive. This is because the volume mounted on a drive can change frequently and without warning.
GEOS
provides routines to get information about a drive. To get general information about a drive, call the routine
DriveGetStatus()
.
This routine takes the drive number and returns a word-length set of
DriveStatus
flags (defined in
drive.h
). If an error condition exists, such as the drive you request not existing, it returns zero. The following flags may be returned:
DriveType
enumerated type.
The lowest four bits of the word contains a member of the
DriveType
enumerated type. The field can be accessed by masking out all the bits except for those set in DS_TYPE.
DriveType
comprises the following values:
DriveGetStatus()
returns the information most often needed about a drive. However, you may sometimes need more obscure information.
For this reason, GEOS provides the routine
DriveGetExtStatus()
. Like
DriveGetStatus()
, it takes the drive number as an argument and returns a word of flags; however, it returns additional flags. The flags returned by
DriveGetStatus()
are set in the lower byte of the returned word; special additional flags are set in the upper byte. Like
DriveGetStatus()
,
DriveGetExtStatus()
returns zero if the drive specified is invalid. The following flags are defined for the upper byte:
Many disk drives can take a variety of disks. For example, high-density 3.5-inch drives can read and write to either 720K disks or 1.44M disks. Every drive has a "default" media type. When you format a disk in that drive, it will, by default, be formatted to the default size.
To find out the default disk type, call the routine
DriveGetDefaultMedia()
. This routine takes one argument, namely the drive number.
It returns a member of the
MediaType
enumerated type.
MediaType
has the following possible values:
If you want to find out if a drive can accommodate a certain kind of disk, call the routine
DriveTestMediaSupport()
. This Boolean routine takes two arguments: a drive number and a member of the
MediaType
enumerated type. If the drive supports that medium, the routine returns
true
(i.e. non-zero); otherwise, it returns
false
(i.e. zero).
To find out the name of a given drive, call
DriveGetName()
. This routine is passed three arguments: a drive number, a pointer to a character buffer, and the size of that buffer.
DriveGetName()
writes the drive's name to the buffer as a null-terminated string; it returns a pointer to that trailing null. If the buffer was not large enough, or the drive does not exist, it returns a null pointer.
GEOS SDK TechDocs
|
|
3 Disks and Drives
|
3.2 Accessing Disks