码迷,mamicode.com
首页 > 其他好文 > 详细

CreateDirectory 创建文件夹

时间:2014-08-15 01:22:46      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:des   blog   http   os   io   strong   文件   for   

函数原型:

CreateDirectory(
  LPCTSTR lpPathName,
  LPSECURITY_ATTRIBUTES lpSecurityAttributes
);

简介:

     CreateDirectory 是Win32API函数,用于创建文件夹。
     参数 lpPathName 表示路径
    参数 lpSecurityAttributes 表示安全属性

============================================================================
例子(程序段):

        //设置属性
        SECURITY_ATTRIBUTES attribute;
        attribute.nLength = sizeof(attribute);
        attribute.lpSecurityDescriptor = NULL;
        attribute.bInheritHandle = FALSE;
        //创建
        if(CreateDirectoryA(“d:\\yanlei”,&attribute) == 0)
            AfxMessageBox("false");

==========================================================================
MSDN上的相关信息:

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 RAPI version of this function exists, and it is named CeCreateDirectory (RAPI).

CreateDirectory(
  LPCTSTR <>
  LPSECURITY_ATTRIBUTES < EM>
);

lpPathName

[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.

<>

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

CreateDirectory is not recursive. The function can create only the final directory in a path. That is, if a parent or intermediate directory does not exist, the function will fail with error message ERROR_PATH_NOT_FOUND.

Some file systems, such as NTFS file system, 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.

In Windows CE 5.0 and later, full path canonicalization is performed before CreateDirectory processes a path name. As a result, trailing backslashes that may appear in a user-provided path name are ignored.

OS Versions: Windows CE 1.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib.

CreateDirectory 创建文件夹,布布扣,bubuko.com

CreateDirectory 创建文件夹

标签:des   blog   http   os   io   strong   文件   for   

原文地址:http://www.cnblogs.com/leadtheway/p/3913770.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!