函数原型
int _getdrives(void);
Example
代码示例
ULONG DriveMask = _getdrives();
while(DriveMask)
{// list all the drives...
//列出所有驱动器
if(DriveMask & 1)
printf(mydrives);
++mydrives[1];
// shift the bit masks binary to the right and repeat
DriveMask >>= 1;
}
The parameters
函数参数
void
The return value
函数返回值
If the function succeeds, the return value is a bitmask representing the currently available disk drives.
Bit position 0 (the leastsignificant bit) is drive A, bit position 1 is drive B, bit position 2 is drive C,
and so on. If the function fails, the return value is zero.
To get extended error information, callGetLastError().
如果函数成功执行,那么返回一个代表当前可用驱动器的位旗标。D0位表示A盘, D1表示B盘, D2表示C盘,以此类推。 如果函数执行失败,那么返回一个非零值,可以通过GetLastError函数获取出错信息
The header file
要包含的头文件
<direct.h>
Table 5: _getdrives() information
表5 _getdrives() 函数使用信息
§ The following program example uses the _getdrives() function to list the available logical drives in the current machine.