Click here to Skip to main content
15,881,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Comments
Richard MacCutchan 26-Oct-13 7:47am    
If you receive an error from a command then please provide exact details; we cannot see your screen or read your mind. You will also need to research Windows and Linux separately as they have quite different file systems. For Linux you could start by looking at the df command.

1 solution

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>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900