How to check if directory exist using C++ and winAPI
2024-09-07 11:52:17
如果看文件夹是否存在,必须看返回值是不是 INVALID_FILE_ATTRIBUTES
#include <windows.h>
#include <string> bool dirExists(const std::string& dirName_in)
{
DWORD ftyp = GetFileAttributesA(dirName_in.c_str());
if (ftyp == INVALID_FILE_ATTRIBUTES)
return false; //something is wrong with your path! if (ftyp & FILE_ATTRIBUTE_DIRECTORY)
return true; // this is a directory! return false; // this is not a directory!
}
最新文章
- ASP.NET MVC5+EF6+EasyUI 后台管理系统(72)-微信公众平台开发-消息处理
- 谈谈关于Python里面小数点精度控制的问题
- 【Android】Android开源项目分类汇总
- 去除a标签单击后的虚线框
- PostgreSQL Replication之第十二章 与Postgres-XC一起工作(1)
- 5、XML(1)
- sqlserver删除重复数据
- java学习面向对象之接口
- 在QT程序中使用cout和cin
- c++智能指针《二》 std::tr1::shared_ptr
- http服务 Web API的使用
- 海思uboot启动流程详细分析(一)
- 生产环境,vue页面跳转的时候,js报404的问题
- python实现可以被with上下文管理的类或函数
- 【转载】 [unreal4入门系列之七] UE4中的Actor类和Pawn类
- hibernate延迟加载org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.javakc.hibernate.onetomany.entity.DeptEntity.emp, could not initialize proxy - no Session
- python 大全
- SSH方式连接Git服务器需要注意的地方
- 大津法---OTSU算法
- (11)模板语言-if判断