C++中创建目录

 1 char szDirName[] = "文件路径";
 2 CreateDirectory(szDirName, NULL) ;
 3 //这样就可以了

 CreateDirectory功能:
This function creates a new directory. If the underlying file system supports security on files and directories, the function applies a specified security descriptor to the new directory.
(创建一个新的文件夹。如果基本的文件系统在文件或文件夹上支持安全描述,那么该函数将在新建的文件夹上应用指定的安全描述)
原型:BOOL CreateDirectory(  
    LPCTSTR lpPathName,       LPSECURITY_ATTRIBUTES lpSecurityAttributes
 );
 
参数:
lpPathName:包含将被创建的文件夹路径的字符串,字符串的长度不超过MAX_PATH。
 lpSecurityAttributes:忽略,设为NULL
返回值:
成功则返回非零,失败则返回零。

原文地址:https://www.cnblogs.com/MATU/p/3796858.html