c++遍历某个文件夹中所有文件

//filePath:存放所有文件名的txt,文件名之间用回车
//fileList:文件夹中所有文件名存放的位置
//算法:用到ifstream
//用途:读取txt中所有文件名,将文件名存入fileList中
void getFilesName(const char *filePath, vector<string> &fileList)
{
    ifstream file;
    file.open(filePath, ios::in);
    std::string strLine;
    while (getline(file, strLine))
    {
        if (strLine.empty())
            continue;
        fileList.push_back(strLine);
  

猜你喜欢

转载自www.cnblogs.com/shixisheng/p/9184948.html