如何让我的 std::fstream
对象从第二行开始读取文本文件?
最佳答案
使用 getline() 读取第一行,然后开始读取流的其余部分。
ifstream stream("filename.txt");
string dummyLine;
getline(stream, dummyLine);
// Begin reading your stream here
while (stream)
...
(更改为 std::getline(感谢 dalle.myopenid.com))
关于c++ - 如何使用 fstream 从第二行读取文本文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/164344/