시스템 드라이브 목록 얻기

-현재 시스템의 드라이브 목록을 얻습니다.

#include
#include

int main(){
        int cnt;
        int i;
        int drvType;
        char drvRoot[104];
        char path[7]=”A:/*.*”;

        //드라이브 목록을 불러옴
        cnt=GetLogicalDriveStrings(104,drvRoot);

        for(i=0;i                 path[0]=drvRoot[i];

                drvType = GetDriveType(&drvRoot[i]);

                //플로피 디스크 건너 뜀
                if(path[0] < 'C'){
                        continue;
                }

                if(drvType == DRIVE_FIXED || drvType == DRIVE_REMOVABLE ||
                        drvType == DRIVE_RAMDISK || drvType == DRIVE_CDROM ){
                        puts(path);
                }

        }
}


댓글 남기기

바로가기