MFC: Create Directory
Original link: How to check if Directory already Exists in MFC(VC++)?
MSDN Links:
Example:
VC++ MFC DLL project
#include "stdafx.h"
#include <windows.h>
#include <Shellapi.h> // To check if a file/folder exists: // Method 1: GetFileAttributes
// Description:
// Retrieves file system attributes for a specified file or directory.
// Return value:
// a) If the function succeeds, the return value contains the attributes of the specified file or directory. For a list of attribute values and their descriptions, see File Attribute Constants.
// b) If the function fails, the return value is INVALID_FILE_ATTRIBUTES. To get extended error information, call GetLastError.
if (GetFileAttributes(szDirPath) == INVALID_FILE_ATTRIBUTES) {
CreateDirectory(szDirPath,NULL);
} // Method 2: CreateDirectory
// Description:
// Creates a new directory
// Return value:
// a) If the function succeeds, the return value is nonzero.
// b) If the function fails, the return value is zero. To get extended error information, call GetLastError.
if(!CreateDirectory(szDirPath,NULL))
{
if (GetLastError() == ERROR_ALREADY_EXISTS) {
// directory already exists
} else {
// creation failed due to some other reasons
}
}
MFC: Create Directory的更多相关文章
- org.apache.hadoop.hdfs.server.namenode.SafeModeException: Cannot create directory /user/hive/warehouse/page_view. Name node is in safe mode
FAILED: Error in metadata: MetaException(message:Got exception: org.apache.hadoop.ipc.RemoteExceptio ...
- vsftp关于"550 create directory operation failed"问题解决
前提: 昨天晚上配置好了vsftp, 但登陆后,除了浏览,什么也干不了.(如新建文件/文件夹, 删除文件, 重命名等都不可操作) 都是弹出 "550 create directory ope ...
- [hadoop]Cannot create directory /mdrill/tablelist/fact_seller_all_d. Name node is in safe mode.
在执行mdrill创建表的时候报如下异常(蓝色部分为关键): [mdrill@hadoop1101 bin]$ ./bluewhale mdrill create ./create.sql higo ...
- Crontab could not create directory .ssh
最近在利用 crontab 构建自动备份时,遇到了一个问题.我的脚本中包含了用于服务器用户切换使用的 ssh 命令.当我登录到服务器上时,脚本执行正常:当我没有登录到服务器上时,脚本执行失败,错误提示 ...
- 550 Create directory operation failed
往Linux系统中上传文件时候,我们经常会使用FTP连接Linux,也经常会使用mkdir命令来创建目录.最近发现用mkdir创建目录时提示550 Create directory operation ...
- Linux虚拟主机通过FTP软件创建目录时提示550 Create Directory Operation Failed
更新时间:2017-06-07 13:26:11 分享: 问题描述 通过FTP软件连接Linux虚拟主机,在尝试创建新目录时,服务器返回错误提示:550 Create Directory Oper ...
- 非root用户启动redis容器报错mkdir: cannot create directory '/bitnami/redis': Permission denied
问题:使用docker启动容器时,报错如下 zh@debian:~/testPath$ docker-compose up redis Starting testpath_redis_1 ... do ...
- HTTP Status 500 - Unable to create directory
分析原因: 例如:java web项目 上传图片创建文件夹cd /data/apps/static-web/sjk/driver/attachment/编号/文件名称.jpg 在创建文件目录 /dat ...
- Hadoop "Cannot create directory .Name node is in safe mode."解决方案
转载自:http://www.waitig.com/hadoop-name-node-is-in-safe-mode.html 在使用Hadoop建立文件的时候,出现“Cannot create di ...
随机推荐
- SQL Server 2005 盛宴系列 经典教程
SQL Server 2005 盛宴系列 经典教程 [复制链接] 发表于 2007-3-27 14:08 | 来自 51CTO网页 [只看他] 楼主 TECHNET SQL serve ...
- cocos2d-x 基本数学
转自:http://cjhworld.blog.163.com/blog/static/207078036201331510141222/ 数学函数: ccp(x, y); // 以坐标x,y创建一个 ...
- MFC 学习 之 菜单栏的添加
运行环境:vc++ 6.0 win81.通过资源 添加一组 菜单栏 如下: 2.在OnInitDialog()中添加如下代码: // Add "About..." men ...
- SQL Server内存性能分析
内存概念: Working Set = Private Bytes + Shared Memory Working Set:某个进程的地址空间中,存放在物理内存的那一部分 Private Bytes: ...
- 【转】placement new
原文:http://www.cnblogs.com/wanghetao/archive/2011/11/21/2257403.html 1. placement new的含义placement new ...
- sizeof运算符
sizeof运算符返回一条表达式或一个类型名字所占的字节数.sizeof运算符满足右结合律,其所得的值是一个size_t类型的常量表达式.运算符的运算对象有两种形式: sizeof(type) siz ...
- (function(){}).call(window) 严格模式匿名函数的this指向undefined
上次在群里,看到有人发出 (function(){}).call(window) 这么一段代码,问这有什么意义,匿名函数中的this不是始终都指向window的么,为什么还要call,我当时也很疑惑. ...
- QUiLoader 动态加载.ui文件
动态加载UI文件是指,用 Qt Designer 通过拖拽的方式生产.ui 文件.不用 uic工具把.ui 文件变成等价的 c++代码,而是在程序运行过程中需要用到UI文件时,用 QUiLoader ...
- QSqlQueryModel的实例操作
QSqlQueryModel类为SQL的结果集提供了一个只读的数据模型,下面我们先利用这个类进行一个最简单的操作. 我们新建Qt4 Gui Application工程,我这里工程名为queryMode ...
- Android实现资料收藏
1,调web浏览器 Uri myBlogUri = Uri.parse("http://xxxxx.com"); returnIt = new Intent(Intent.ACTI ...