中国开发网: 论坛: 程序员情感CBD: 贴子 223180
品雪: c的倒有一个现成的
#include "FindFiles.h"

int findFiles(char* pattern, FINDCALLBACK action)
{
int batchFileCount = 0;
HANDLE hFind;

// search for the files
WIN32_FIND_DATA findData;

hFind = FindFirstFile(pattern, &findData);
if ( hFind == INVALID_HANDLE_VALUE ) {
printf("not found for pattern %s", pattern);
} else {

// handle first file
action(&findData);
batchFileCount++;

// for-each file found
while ( FindNextFile(hFind, &findData) != 0 ) {
action(&findData);
batchFileCount++;
}

FindClose(hFind);
}

return batchFileCount;
}

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录