功 能: 設定當前磁碟驅動器
用 法: 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;
}