Preciso ligar manualmente close() quando uso um std::ifstream?
Por exemplo, no código:
std::string readContentsOfFile(std::string fileName) {
std::ifstream file(fileName.c_str());
if (file.good()) {
std::stringstream buffer;
buffer << file.rdbuf();
file.close();
return buffer.str();
}
throw std::runtime_exception("file not found");
}
Preciso ligar file.close()manualmente? Não deve ifstreamusar o RAII para fechar arquivos?