#include
class FileWriter {
private:
std::ofstream fileStream;
public:
FileWriter(const std::string& filename) : fileStream(filename) {}
void write(const std::string& content) {
fileStream << content;
}
~FileWriter() {
if (fileStream.is_open()) {
fileStream.close();
}
}
};
int main() {
FileWriter file("example.txt");
file.write("Hello, World!\n");
}