Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
DosSelectDisk (1.2)
◄Function Group► ◄Overview► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_DOSFILEMGR
USHORT DosSelectDisk(usDriveNumber)
USHORT usDriveNumber; /* default-drive number */
The DosSelectDisk function selects the specified drive as the default drive
for the calling process.
The DosSelectDisk function is a family API function.
Parameter Description
────────────────────────────────────────────────────────────────────────────
usDriveNumber Specifies the number of the default drive. Drive A is 1,
drive B is 2, and so on.
Return Value
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be the following:
ERROR_INVALID_DRIVE
Example
This example calls the DosSelectDisk function to change the default drive to
drive C. It then changes the default path to the root and opens the file
abc.txt.
HFILE hf;
USHORT usAction;
DosSelectDisk(3); /* selects drive C: */
DosChDir("\\", 0L); /* changes to the root directory */
DosOpen("abc.txt", &hf, &usAction, 0L, FILE_NORMAL,
FILE_OPEN | FILE_CREATE,
OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYWRITE, 0L);
See Also
DosChDir, DosQCurDisk
♦