小编Log*_*nes的帖子

GetFileAttributesA为现有目录返回"17"."16"表示它是一个目录,文档中没有提到"17"

Windows 7 64位,使用mingw进行编译.我正在尝试测试给定路径是否是使用Windows标头中的GetFileAttributesA的目录.作为目录的东西的常量是16.出于某种原因,它返回17.我的代码如下所示:

#include <iostream>
#include <windows.h>

void dir_exists(std::string dir_path)
{
    DWORD f_attrib = GetFileAttributesA(dir_path.c_str());
    std::cout << "Current: " << f_attrib << std::endl <<
        "Wanted: " <<
        FILE_ATTRIBUTE_DIRECTORY << std::endl;
}

int main()
{
    dir_exists("C:\\Users\\");
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

当我运行它时,输出是:

Current: 17  
Wanted: 16
Run Code Online (Sandbox Code Playgroud)

电流应该在这里返回16.正如我在主题中所说,我甚至无法提及文档中的17个含义.

c++ windows winapi mingw constants

2
推荐指数
1
解决办法
2017
查看次数

标签 统计

c++ ×1

constants ×1

mingw ×1

winapi ×1

windows ×1