c列出活动驱动器的代码 [英] c code to list active drives

查看:55
本文介绍了c列出活动驱动器的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该使用什么命令来显示consol上的活动驱动器列表。

for windows 8 os以及linux。



i只知道可以使用system()函数.....我有一些像wmic这样的函数但却给我错误。

what command should i use to display the list of active drives on consol.
for windows 8 os as well as for linux.

i just know that system() function can be used..... i have some functions like "wmic" but is giving me error.

推荐答案

Don'了解Linux。这是你在windows中可以做的事情



调用GetLogicalDrives()

它返回一个带有代表可用驱动器的位(set)的DWORD:bit 0对于驱动器A,1对于B,2对于C ...







调用GetLogicalDrives( BufferLength,Buffer)

它将返回一串以空字符结尾的驱动器字母串。 (最后还有一个空)

如C:\< null> D:\< null>< null>
Don't know about Linux. Here's what you can do in windows

Call GetLogicalDrives()
It returns a DWORD with bits (set) representing available drives : bit 0 for drive A, 1 for B, 2 for C ...

or

Call GetLogicalDrives(BufferLength, Buffer)
It will return a string of null-terminated strings of drive letters. (With one more null at the end)
like C:\<null>D:\<null><null>


这篇关于c列出活动驱动器的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆