Link to home
Start Free TrialLog in
Avatar of Alexander
AlexanderFlag for France

asked on

Verify a path ...

How to verify if a path is a valid path (a path that exist) ?
Avatar of dabbler
dabbler

1) Call OpenFile (.., .., OF_EXIST)
2) Call FindFirstFile (.., &a_win32finddata_struct)
   // don't forget to call FindClose () on the returned handle,
   // if it's not INVALID_HANDLE_VALUE
2) Call GetShortPathName (...)
Avatar of Alexander

ASKER

Sorry but i dont want to check if a file exist in a path but only if the path exist. If one of those functions do that can you be more explicit ?
Thank you !
ASKER CERTIFIED SOLUTION
Avatar of dabbler
dabbler

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok, thank you, but finally i've used the SetCurrentDirectory function, because i need to change too, if the directory exist !


Isn't this better?

                    System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(stringPath);

                    bValidFile = di.Exists;