如果我使用seekg()
搜索文件末尾,std::getline()
是否会更改传递给它的std::string
?
//readWrite is an fstream object.
//fileLineLength is an int, every line in the file will be the same length.
string RWDN::read(size_t number){
string line = "";
readWrite.seekg(number * fileLineLength);
getline(readWrite, line);
return line;
}
这会返回一些随机内容,还是line
仍为空字符串?