Click here to Skip to main content
12,397,027 members (68,009 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: MFC
Hi.

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.

Thanks.

Stan the man
Posted 26-Sep-12 7:08am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

hi
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;
if(f.Open(drive_path+_T("\\\\a.txt"),CFile::modeCreate|CFile::modewrite)){
   f.Close();
   //drive_path is valid drive
}else{
   //drive_path isnot valid
}
  Permalink  
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 29 Oct 2012
Copyright © CodeProject, 1999-2016
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