zoukankan      html  css  js  c++  java
  • 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.

     

      A remote application interface (RAPI) version of this function exists, and it is named CeCreateDirectory.

     

      BOOL CreateDirectory(LPCTSTR lpPathNameLPSECURITY_ATTRIBUTES lpSecurityAttributes );

     

      ParameterslpPathName [in] Long pointer to a null-terminated string that specifies the path of the directory to be created. There is a default string size limit for paths of MAX_PATH characters. This limit is related to how the CreateDirectory function parses paths.

     

      lpSecurityAttributes [in] Ignored; set to NULL. Return ValuesNonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

     

      RemarksSome file systems, such as NTFS, support compression or encryption for individual files and directories. On volumes formatted for such a file system, a new directory inherits the compression and encryption attributes of its parent directory.

     

      第一个参数值为文件夹名称,第二个参数值为安全属性,一般设置为NULL即可。如果正确创建,返回值为1,如果没有正常创建文件夹,则返回0。

     

      特别的:该函数每次调用时都只能创建一级文件夹,即文件夹中不能再包含子文件夹。

     

      当希望创建含有子文件夹的文件夹时,可以先使用该函数创建一级文件夹,然后再使用该函数在一级文件夹下创建子文件夹。如:

     

      希望创建:d:\\TEST\\temp,

     

      则:CString str = “d:\\TEST”;

     

      CreateDirectory(str, NULL);

     

      str = str + \\temp;

     

      CreateDirectory(str, NULL);

  • 相关阅读:
    使用C#直接修改表结构(添加列,删除列)【MS SQL SEVER】
    Nuget-ConsoleExtClass给控制台添加颜色
    Thread线程Join()的使用
    C#将List集合类转换成DataTable-帮助类
    C#动态拼接Linq
    C#使用AutoMapper
    go GOPROXY=http://goproxy.io 设置
    mysql5.6切到5.7(阿里云RDS换到自建库)
    vue学习之----如何在谷歌浏览器中使用vue调试工具
    vue学习之----兄弟组件之间通信方式
  • 原文地址:https://www.cnblogs.com/likeIT/p/2564067.html
Copyright © 2011-2022 走看看