📅  最后修改于: 2022-03-11 14:44:48.102000             🧑  作者: Mango
// Reading a file
#include
#include
#include
int main()
{
std::string line;
std::ifstream file("example.txt");
if(file.is_open())
{
while(getline(file, line))
{
std::cout << line << '\n';
}
file.close();
}
else std::cout << "Unable to open file";
return 0;
}