
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
#include <dos.h>
void _dos_setdrive( unsigned drive, unsigned *total );
Description:
The _dos_setdrive function uses system call 0x0E to set the current
default disk drive to be the drive specified by drive, where 1 = drive
A, 2 = drive B, etc. The total number of disk drives is returned in the
word pointed to by total. For DOS versions 3.0 or later, the minimum
number of drives returned is 5.
Returns:
The _dos_setdrive function has no return value. If an invalid drive
number is specified, the function fails with no error indication. You
must use the _dos_getdrive function to check that the desired drive has
been set.
Example:
#include <stdio.h>
#include <dos.h>
void main()
{
unsigned drive1, drive2, total;
_dos_getdrive( &drive1 );
printf( "Current drive is %c\n", 'A' + drive1 - 1 );
/* try to change to drive C */
_dos_setdrive( 3, &total );
_dos_getdrive( &drive2 );
printf( "Current drive is %c\n", 'A' + drive2 - 1 );
/* go back to original drive */
_dos_setdrive( drive1, &total );
_dos_getdrive( &drive1 );
printf( "Current drive is %c\n", 'A' + drive1 - 1 );
printf( "Total number of drives is %u\n", total );
}
produces the following:
Current drive is D
Current drive is C
Total number of drives is 6
Classification:
DOS
Systems:
DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32, DOS/PM
See Also:
_dos_getdiskfree, _dos_getdrive, _getdiskfree, _getdrive
See Also: _dos_getdiskfree _dos_getdrive
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson