本文介绍了解释dwFileAttributes的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我尝试阅读包含文件的子目录.使用调试器,我看到正确的文件名,但是"dwFileAttributes"的值是48,这是错误的,据我所知应该是16.我试过其他目录,它们很好.

您能帮我理解为什么为dwFileAttributes 分配48而不是16的原因吗?

Hi,

I try to read a sub direcory which cointains files. With debugger I see the right file name but "dwFileAttributes" has value 48 which is wrong, it should be 16 what I understand. I have tried with other directory and they are fine.

Could you please help me to understand why dwFileAttributes is assigned 48 and not 16?

WIN32_FIND_DATA FileData
handle  =   FindFirstFile(path,&FileData);
if(FileData.dwFileAttributes  == 16)
{
}


在此先感谢
MH


Thanks in advance
M.H

推荐答案

WIN32_FIND_DATA FileData
handle = FindFirstFile(path, &FileData);
if ((FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
   // It's a directory...
}



这篇关于解释dwFileAttributes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 03:43