1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
int main(void) {
int dr_type=99;
char dr_avail[MAX_PATH];
char *temp=dr_avail;
GetLogicalDriveStrings(MAX_PATH,dr_avail);
while(*temp!=NULL) { // Split the buffer by null
dr_type=GetDriveType(temp);
switch(dr_type) {
case 2: // Removable Drive
printf_s("%s : Removable Drive\n",temp);
char Drive[sizeof(temp)+1];
sprintf_s(Drive, "%s", temp);
char Label[MAX_PATH];
DWORD dwDontNeedThis;
GetVolumeInformation ( Drive, Label, sizeof ( Label ), NULL, &dwDontNeedThis, &dwDontNeedThis, NULL, 0 );
printf_s("%s : Label\n",Label);
char cLabel[2] = "N"; // ERROR HERE ??
if(Label == cLabel){ // ERROR HERE ??
char *Dest; // ERROR HERE ??
strcat(Dest,temp); // ERROR HERE ??
strcat(Dest,"\out.txt"); // ERROR HERE ??
if(!copyFile ("C:\\test.txt", Dest)) { // ERROR HERE ??
printf_s("File not copied\n");
} else {
printf_s("File copied\n");
}
} else { printf_s("Drive label NOT %s\n",cLabel); }
break;
}
temp += lstrlen(temp) +1;
}
return 0;
}
|