既不是逐行的,也不是特殊的逐字节函数.相反,以下应该做你的工作:
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!
Run Code Online (Sandbox Code Playgroud)
而且你已经完成了,因为它buffer
包含了文件的内容.
归档时间: |
|
查看次数: |
4262 次 |
最近记录: |