#include<iostream>
#include<io.h>
using namespace std;
void main()
{
char *filename = "D:\\MyBin\\pic\\*.jpg";
struct _finddata_t fileinfo;
long handle;
handle = _findfirst(filename,&fileinfo);
if(handle == -1) cout<<"fail..."<<endl;
else
cout<<fileinfo.name<<endl;
while(!_findnext(handle,&fileinfo))
{
cout<<fileinfo.name<<endl;
}
_findclose(handle);
system("pause");
}
结果如图