#include#include using namespace std; int main() { ifstream inFile; inFile.open("input.txt", ios::in); // Read data from the file inFile.close(); // Close the stream return 0; }
#includeBoth examples use the fstream package library.#include using namespace std; int main() { ifstream inFile; inFile.open("input.txt", ios::in); string line; while(getline(inFile, line)) { cout << line << endl; } inFile.close(); // Close the stream return 0; }