in a windows console how can i get the drive letter of the available cd rom drive? Can i use one of the C++ functions or this going to be a windows specific function form windows headers?
Printable View
in a windows console how can i get the drive letter of the available cd rom drive? Can i use one of the C++ functions or this going to be a windows specific function form windows headers?
this IS OS specific,
the following code should find all the CD-ROM drives
Code:
#include <direct.h> //MSVC i don't know on other compilers...
#include <windows.h>
#include <stdio.h>
int main(void)
{
int i = 0;
char buf[20];
for(;i < 26;i++)
{
if(!_chdrive(i))
{
sprintf(buf,"%c:\\",i+ 'A' - 1);
if(GetDriveType(buf) == DRIVE_CDROM)
printf("CD-ROM on Drive:%s",buf);// FOUND CD-ROM do whatever...
}
}
return 0;
}
those developers!!!
direct.h isnt in UNIX, i believe ..