如果看文件夹是否存在,必须看返回值是不是 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!
}

How to check if directory exist using C++ and winAPI的更多相关文章

  1. MEF load plugin from directory

    var catalog = new AggregateCatalog(); catalog.Catalogs.Add(new DirectoryCatalog(".")); var ...

  2. MFC: Create Directory

    Original link: How to check if Directory already Exists in MFC(VC++)? MSDN Links: CreateDirectory fu ...

  3. C# Directory类的操作

    Directory类位于System.IO 命名空间.Directory类提供了在目录和子目录中进行创建移动和列举操作的静态方法.此外,你还可以访问和操作各种各样的目录属性,例如创建或最后一次修改时间 ...

  4. github免输用户名/密码SSH登录的配置

    从github上获取的,自己整理了下,以备后用. Generating an SSH key mac windows SSH keys are a way to identify trusted co ...

  5. 使用roslyn代替MSBuild完成解决方案编译

    原本我是使用批处理调用 MSBuild 完成解决方案编译的,新版的 MSBuild 在 Visual Studio 2015 会自带安装. 当然在Visual Studio 2015 中,MSBuil ...

  6. git配置ssh(github)

    [参考官方文档] SSH keys are a way to identify trusted computers, without involving passwords. The steps be ...

  7. System Error Codes

    很明显,以下的文字来自微软MSDN 链接http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx M ...

  8. 使用Githua管理代码

    原创博客:转载请标明出处:http://www.cnblogs.com/zxouxuewei/ 1.安装配置git服务器      a.安装ssh,因为git是基于ssh协议的,所以必须先装ssh: ...

  9. [SharePoint] SharePoint 错误集 1

    1. Delete a site collection · Run command : Remove-SPSite –Identity http://ent132.sharepoint.hp.com/ ...

随机推荐

  1. 美国NOAA/AVHRR遥感数据

    1.美国国家海洋和大气管理局(National Oceanic and Atmospheric Administration,NOAA) 美国国家海洋和大气管理局隶属于美国商业部下属的科技部门,主要关 ...

  2. Activiti任务分配

    分配任务负责人 一.固定分配 在进行业务流程建模时指定固定的任务负责人 在properties 视图中,填写Assignee 项为任务负责人. 注意: 由于固定分配方式,任务只管一步一步执行任务,执行 ...

  3. 数据结构与算法复习-----leetcodeOJ题解

    Isomorphic Strings Given two strings s and t, determine if they are isomorphic. Two strings are isom ...

  4. linux 访问windows 共享文件

    用到的方法是 CIFS (Common Internet File System)windows自己的网络文件系统 操作系统: Linux为 debian. Windows 为 windows 8   ...

  5. 【线段树基础】NKOJ 1321 数列操作

    时间限制 : 10000 MS   空间限制 : 165536 KB 问题描述 假设有一列数{Ai}(1≤i≤n),支持如下两种操作:将Ak的值加D.(k, D是输入的数)输出As+As+1+…+At ...

  6. Face The Right Way POJ - 3276(区间)

    Farmer John has arranged his N (1 ≤ N ≤ 5,000) cows in a row and many of them are facing forward, li ...

  7. Rust入坑指南:万物初始

    有没有同学记得我们一起挖了多少个坑?嗯-其实我自己也不记得了,今天我们再来挖一个特殊的坑,这个坑可以说是挖到根源了--元编程. 元编程是编程领域的一个重要概念,它允许程序将代码作为数据,在运行时对代码 ...

  8. wifi无线桥接

    考虑到不同路由器配置上或许有细微差别,我此处路由器是水星(牌子)路由器. 首先需要2台路由器,一台已经能够上网,作为主路由器:另一台啥都没有配置,将来用作副路由器,与主路由器桥接. 步骤: 获取主路由 ...

  9. C#通用类库整理--日志记录

    日志的记录是将程序过程中的一些行为数据记录下来,方便开发.运维迅速的找到问题的所在,节省时间.使用时在 站点的web.config 中的<appSettings></appSetti ...

  10. ASP.NET Core技术研究-探秘依赖注入框架

    ASP.NET Core在底层内置了一个依赖注入框架,通过依赖注入的方式注册服务.提供服务.依赖注入不仅服务于ASP.NET Core自身,同时也是应用程序的服务提供者. 毫不夸张的说,ASP.NET ...