16,472
社区成员
发帖
与我相关
我的任务
分享
int SelectCatalog(char* path)
{
try
{
WIN32_FIND_DATA w_file;
HANDLE h_file;
char tempPath[1024]={0};
sprintf(tempPath,"%s\\*.txt",path);
h_file = FindFirstFile(tempPath,&w_file);
if (INVALID_HANDLE_VALUE==h_file)
{
return -1;
}
char* fileName = w_file.cFileName;
memset(tempPath,0,1024);
sprintf(tempPath,"%s\\%s",path,fileName);
ReadFile(tempPath,fileName);
while (FindNextFile(h_file,&w_file))
{
char* fileName = w_file.cFileName;
memset(tempPath,0,1024);
sprintf(tempPath,"%s\\%s",path,fileName);
ReadFile(tempPath,fileName);
}
FindClose(h_file);
}
catch(...)
{
return -1;
}
}