C ++ / VC ++ PHP的SPLFileObject类的替代方案
-
11-12-2019 - |
题
是否有任何手编码类或VC ++插件,与PHP的SplFileObject
相同?
请参阅问题
解决方案
不确定要使用它的原因,iostreams或boost :: filesystem是什么?
http://msdn.microsoft.com/de-de / library / 22z6066f%28v= vs.100%29
http://www.boost。org / doc / libs / 1_49_0 / libs / filesystem / v3 / doc / index.htm
更新(在读取评论后添加代码示例):
这样的东西然后?
#include <iostream>
#include <fstream>
#include <string>
int main(int argc, char* argv[])
{
auto fd = std::fstream("veryLargeFile.txt");
if (fd.good()) {
std::string buffer;
fd.seekg(200000);
std::getline(fd, buffer);
std::cout << buffer << std::endl;
}
fd.close();
return 0;
}
. 不隶属于 StackOverflow