2
我寫了一個小程序,將搜索我的電腦中的所有邏輯驅動器,然後打印它們。但不同的wirh我的預期,它不顯示它們..這裏是我的代碼示例邏輯驅動器字母不顯示
TCHAR szDrive[] = (" A:");
DWORD drive = GetLogicalDrives();
printf("The bitmask of the logical drives in hex: %0X\n", drive);
printf("The bitmask of the logical drives in decimal: %d\n", drive);
if(drive == 0)
printf("GetLogicalDrives() failed with failure code: %d\n", GetLastError());
else
{
printf("This machine has the following logical drives:\n");
while(drive)
{
// Use the bitwise AND, 1â€"available, 0-not available
if(drive & 1)
printf("%S ", (const char *)szDrive);
// increment, check next drive
++szDrive[1];
// shift the bitmask binary right
drive >>= 1;
}
printf("\n ");
}
你調試了你的代碼來確定哪裏出了問題嗎? –
是的,我did..and沒有什麼是錯誤的根據我的代碼調試器 – user2660085
什麼是輸出?最新錯誤? –