Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C++/MFC
I am trying to find a way to check whether a drive is valid on the hard disk. Ex: if I name a network drive to T: is there an API I can use to check that T: is valid (maybe the network is down?).
I would appreciate any hint or help on this.
Stan the man
Posted 26-Sep-12 8:08am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I don't know the api but you can do this with CFile.
save an empty file to the drive, if it success it will returns 1 else it returns 0
CFile f;
   //drive_path is valid drive
   //drive_path isnot valid

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

  Print Answers RSS
0 Maciej Los 515
1 OriginalGriff 390
2 Sergey Alexandrovich Kryukov 314
3 CHill60 305
4 CPallini 285
0 Sergey Alexandrovich Kryukov 9,897
1 OriginalGriff 9,395
2 Peter Leow 5,162
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,036

Advertise | Privacy | Mobile
Web02 | 2.8.150327.1 | Last Updated 29 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100