C++ buffered file reading

会有一股神秘感。 提交于 2019-12-04 16:56:52

Neither line-by-line, nor special byte-wise functions. Instead, the following should do your job:

std::ifstream file("input.txt");
std::istream_iterator<char> begin(file), end;

std::vector<char> buffer(begin, end); //reading the file is done here!
//use buffer. it contains the content of the file!

And you're done, as buffer contains the content of the file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!