非VC下如何获取文件名列表

来源:互联网 发布:vscode怎么移除文件夹 编辑:程序博客网 时间:2024/05/02 08:41

using namespace std;


int main()
{
_finddata_t file;
long lf;
if((lf = _findfirst("C:\\WINDOWS\\*.*", &file))==-1l)
cout<<"文件没有找到";
else
{
cout<<"文件列表"<<endl;
while(_findnext(lf,&file)==0)
{
cout << file.name <<endl;
}
}
_findclose(lf);
getchar();
return 0;
}
原创粉丝点击