searching for hidden files using winapi

Posted by Kristian on Stack Overflow See other posts from Stack Overflow or by Kristian
Published on 2010-06-01T22:03:04Z Indexed on 2010/06/01 22:03 UTC
Read the original article Hit count: 216

Filed under:
|

HI i want to search for a hidden files and directories in a specefic given path but I don't know how to do it for hidden files i do know how to search for normal files and dir i did this code but im stuck can't make it search for only hidden files

#include "stdafx.h"
#include <windows.h>


int _tmain(int argc, _TCHAR* argv[])
{
    TCHAR *fn;
    fn=L"d:\\*";
    HANDLE f;

    WIN32_FIND_DATA data;
    {
        FILE_ATTRIBUTE_HIDDEN;
    }

    f=FindFirstFile(fn,&data);
    if(f==INVALID_HANDLE_VALUE){
        printf("not found\n");
        return 0;
    }
    else{

        _tprintf(L"found this file: %s\n",data.cFileName);
        while(FindNextFile(f,&data)){
            _tprintf(L"found this file: %s\n",data.cFileName);
        }
    }

    FindClose(f);
    return 0;
}

© Stack Overflow or respective owner

Related posts about c++

Related posts about winapi