#include <iostream>
#include <fstream>
#include <sstream>
int main() {
std::ifstream file("example.txt"); // Open file named "example.txt"
std::stringstream buffer; // Create a string stream
if (file) { // If the file is open and accessible
buffer << file.rdbuf(); // Read the entire file into the stringstream
std::string fileContent = buffer.str(); // Get the content of the stringstream as a string
// Use fileContent as needed
file.close(); // Close the file stream
} else {
std::cout << "Unable to open file." << std::endl; // Print error message if file cannot be opened
}
return 0;
}