C List Files on Windows

C List Files on Windows

C 列舉檔名

#include   <io.h>
#include   <time.h>
 
void main(void)
{
    struct   _finddata_t   c_file;
    long   hFile;
 
    if(   (hFile = _findfirst(   "*.* ",   &c_file   )) == -1L)
        printf(   "No   *.c   files   in   current   directory!n "   );
    else
    {
        do
        {
            if (c_file.attrib   &   _A_ARCH)
                printf("%sn", c_file.name);
        }
        while (_findnext(   hFile,   &c_file   ) == 0);
 
        _findclose(   hFile   );
    }
}

 

Dotblogs 的標籤: ,