我正在编写一个文件来搜索当前目录中的关键字。每次运行它时,我的程序都会出现错误。它说:'错误:没有匹配函数调用'getline(char [256],std :: __ cxx11 :: string&)'
以下是我的代码的相关部分:
struct dirent *pent = NULL;
while (pent = readdir (pdir)){
string line;
int lineNum = 0;
for(int i = 1; i < argc; i++){
while(std::getline(pent->d_name, line)){
if (line.find(argv[i])/*!=string::npos*/){
cout << argv[i] << " found in " << pent << " on line " << lineNum << endl;
}
}
lineNum++;
}