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 ...
随机推荐
- RecyclerView全面解析
写在前面 起深入浅出这名字的时候我是慎重又慎重的,生怕被人骂标题党,写的什么破玩意还敢说深入浅出.所以还是请大家不要抱着太高的期望,因为没有期望就没有失望,就像陈润说的,超预期嘛.全当看小说的心情来看 ...
- MFC 学习 之 状态栏的添加
1.首先声明一个 CStatusBar m_bar;//声明对象2.然后打开视图资源 String Table中添加两个字段值 3.创建了两个字段值以后,在OnintDialog() 所在的 .cp ...
- VS2012的SVN插件VISUALSVN
http://www.visualsvn.com/visualsvn/download/
- ZOJ 3822 Domination 期望dp
Domination Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/showProblem ...
- hdu 5437 Alisha’s Party 优先队列
Alisha’s Party Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/contests/contest_sh ...
- linux netlink套接字学习资料
理论: http://blog.csdn.net/unbutun/article/details/3394061 进一步深入: http://edsionte.com/techblog/archive ...
- Android 屏幕画笔实现
Tuya.rar
- Android 获取信号强度
大 家看到标题就明白了,我们有的时候在电梯里,有时有的电话有信号,有时有的电话没有信号,这个是非常闹心的,要是我们能监听一下我们自己手机信号的强度就 好了.这样,当我们在等重要的人士的电话,不至于接不 ...
- Docker容器案例:应用 Mysql
原创 杜亦舒 前阶段体验 Mysql 的新版本 5.7.13,由于机器里已经有 Mysql了,再安装另一个版本会有一些麻烦,为了简单,便使用 Docker 容器来安装 可能有人会认为没必要,在一台 ...
- OAuth 2 Developers Guide--reference
Introduction This is the user guide for the support for OAuth 2.0. For OAuth 1.0, everything is diff ...