View Single Post
Old 11-07-2003, 10:26 PM   #4 (permalink)
charliex
Junkie
 
Location: North Hollywood
basically each bit in the 32 bit return value is set to 1 if a drive exists, and each bit position corresponds to a drive letter

all you have to do is, test the bit position corresponding to the drive letter to determine if it exists.


In C you could use a bitfield and let the compiler handle all the tests for you. either otherwise its simply doing an and with a 1&lt&ltbit_number where the first is drive A.

Code:
val = GetLogicalDrives( );
	for(i=0;i&lt26;i++) {
		printf("drive %c: is %s\n", i+'A',ret&(1&lt&lti)?"Available" : "Not Available");
	}
thatd list if the drive is available or not (barring typos)
charliex is offline  
 

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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73