在文件结尾之后,seekg()如何影响getline()?

时间:2017-11-07 05:52:36

标签: c++ fstream

如果我使用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仍为空字符串?

0 个答案:

没有答案