以下列出读取目录下所有文件的方法,遇到添加。
方法1 cmd dir + 读文件
在windows命令行中
dir d:SVNmyWorldVS2019QM_improve4317server /d/w/s/b > filelist.txt
然后读文件:

void get_finename() { ifstream in; in.open("filelist.txt", ios::in); if (!in) { cout << "open file fail!"; exit(1); } else cout << "open file success!" << endl; while (!in.eof()) { string temp; getline(in, temp, ' ');//读每行的最后一个会读取到形如 6B cout << temp << endl; } in.close(); }