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 Sergey Alexandrovich Kryukov 450
1 OriginalGriff 230
2 DamithSL 150
3 Dave Kreskowiak 110
4 Suvendu Shekhar Giri 110
0 OriginalGriff 7,740
1 DamithSL 5,644
2 Sergey Alexandrovich Kryukov 5,404
3 Maciej Los 5,011
4 Kornfeld Eliyahu Peter 4,539

Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 29 Oct 2012
Copyright © CodeProject, 1999-2014
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