函数名: setdisk
功 能: 设置当前磁盘驱动器
用 法: #include <dir.h>
int setdisk(int drive);
程序例:
#include <stdio.h>
#include <dir.h>
int main(void)
{
int save, disk, disks;
/* save original drive */
save = getdisk();
/* print number of logic drives */
disks = setdisk(save);
printf("%d logical drives on the system\n\n", disks);
/* print the drive letters available */
printf("Available drives:\n");
for (disk = 0;disk < 26;++disk)
{
setdisk(disk);
if (disk == getdisk())
printf("%c: drive is available\n", disk + 'a');
}
setdisk(save);
return 0;
}