4/26/2012

(TIP) C++ Make folder (CreateDirectory)


The method to create folder is esay.
You can do this jop using window api.

this is sample code for making folder

//make path string 
char buf[MAX_PATH];
DWORD dir = GetCurrentDirectory(MAX_PATH, buf);
CString directory = buf;
directory += "\\New_Folder";

//make folder
if(!CreateDirectory(directory,NULL))
//check error
         switch (GetLastError()) {
           case ERROR_ALREADY_EXISTS: //Folder exists
 break;
     default:
 ;
}
//end ^^

No comments:

Post a Comment