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
什么是输出?最新错误? –