File Handling with fstream
C++ provides the fstream library for file input/output operations.
#include <fstream>
#include <iostream>
using namespace std;
int main() {
ofstream outFile("example.txt");
outFile << "Hello, file!";
outFile.close();
ifstream inFile("example.txt");
string content;
getline(inFile, content);
cout << content;
inFile.close();
}ofstream writes to files, and ifstream reads from files.
