📜  c++ 将整个文件读入变量 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:50.341000             🧑  作者: Mango

代码示例1
// Read Entire File Into a String Variable
// More Info: https://stackoverflow.com/a/116177/7573706
ifstream myFile("stuff.txt");
string str(std::istreambuf_iterator{myFile}, {});

Requirements: 
#include 
#include 
#include 
#include