What happens with CreateDirectory if the directory already exists? Also, how can you check if a directory exists?
Printable View
What happens with CreateDirectory if the directory already exists? Also, how can you check if a directory exists?
The function returns 0 and GetLastError equates to ERROR_ALREADY_EXISTSQuote:
Originally posted by golfinguy4
What happens with CreateDirectory if the directory already exists?
Quote:
Originally posted by golfinguy4
Also, how can you check if a directory exists?
Try the above?
You can also browse the parent directory with FindFirstFile()/FindNextFile(), it will also report directories, (check the file attributes field, directories have FILE_ATTRIBUTE_DIRECTORY set).
Thanx Fordy and adrianxw, that was exactly what I was looking for.