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 ...
随机推荐
- Struts的类型转换
struts中jsp提交的数据,struts会自动转换为action中的属性类型: 对于基本的数据类型以及日期类型会自动转换: 就像前面那一篇博客的代码封装一样,会把字符串类型传过来的数据转化为相应的 ...
- 9 个让 JavaScript 调试更简单的 Console 命令
一.显示信息的命令 <!DOCTYPE html> <html> <head> <title>常用console命令</title> < ...
- linq to sql 扩展方法
老赵的博客:http://blog.zhaojie.me/2008/02/using-translate-method-and-modify-command-text-before-query-in- ...
- Win8.1激活
激活查询:在桌面状态下输入“Win+R”,进入运行栏目,输入slmgr.vbs -dlv 显示:最为详尽的激活信息,包括:激活ID.安装ID.激活截止日期 http://www.nruan.com/w ...
- TableControl大小变化
TableControl跟随Form大小变化: 选中TableControl,而不是TablePage,右侧Layout: 可以对其设置居上.居下等位置
- C++Vector使用方法
C++内置的数组支持容器的机制,可是它不支持容器抽象的语义.要解决此问题我们自己实现这种类.在标准C++中,用容器向量(vector)实现.容器向量也是一个类模板.标准库vector类型使用须要的头文 ...
- web工作方式,浏览网页,打开浏览器,输入网址按下回车键,然后会显示出内容,这个过程是怎样的呢?
以下内容摘自<Go Web编程>,介绍的通俗易懂. 我们平时浏览网页的时候,会打开浏览器,输入网址后按下回车键,然后就会显示出你想要浏览的内容.在这个看似简单的用户行为背后,到底隐藏了些什 ...
- [VirtualBox] Install Ubuntu 14.10 error 5 Input/output error
After you download the VirtualBox install package and install it (just defualt setting). Then you sh ...
- mysqldump原理4
http://blog.csdn.net/dba_waterbin/article/details/23611601?utm_source=tuicool&utm_medium=referra ...
- linux内核系统调用和标准C库函数的关系分析
http://blog.csdn.net/skyflying2012/article/details/10044343