How to Check

closed account (9wX36Up4)
Hi guys me again
my question is how to check c: or d: i just want to learn how can i check is it exist or not
thanks in advance
Last edited on
On Windows the C: drive will always exist. You can test for other drives by using the "CreateFile()" function with OPEN_EXISTING as the 5th argument.
closed account (9wX36Up4)
thanks
I THINK (not 100% sure) that if you install Windows XP as a secondary OS, the drive letter may not be C:, and I imagine that throws away the guarantee of existence for C:. I think both Vista and 7 swap drive letters so it is always the C: drive. Just not XP.
closed account (9wX36Up4)
i have searched some but would someone write an example line of it pls
1
2
3
4
5
6
7
8
9
10
  HANDLE hFile=CreateFile("D:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
  if(hFile==INVALID_HANDLE_VALUE)
    {
       cout <<"Partition does not exist or you don\'t have rights to access it"<<endl;
    }
  else
    {
      cout <<"Partition exists"<<endl;
    }
  CloseHandle(hFile);
closed account (9wX36Up4)
thank u very much Null i sincerely thank u
Topic archived. No new replies allowed.