...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <fstream> #include <string> void f(const std::string &file_namefileName) { std::fstream file(file_namefileName); if (!file.is_open()) { // Handle error return; } file << "Output some data"; std::string str; file >> str; } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <fstream> #include <string> void f(const std::string &file_namefileName) { std::fstream file(file_namefileName); if (!file.is_open()) { // Handle error return; } file << "Output some data"; std::string str; file.seekg(0, std::ios::beg); file >> str; } |
...