#include<iostream> #include<io.h> using namespace std; int main(){ _finddata_t file; long lf; //输入文件夹路径 if((lf = _findfirst("d:\\OSG\\Data\\*.*", &file))==-1) cout<<"Not Found!"<<endl; else{ //输出文件名 cout<<"file name list:"<<endl; while(_findnext( lf, &file)==0){ cout<<file.name<<endl; } } _findclose(lf); return 0; }