Can someone please write and describe the steps for inputting a .txt file into a C++ program. I need my program to output information based on the .txt file through a struct but I'm having trouble inserting the .txt file into the program.
#include <iostream>
#include <fstream> // dont forget this
#include<string>
usingnamespace std;
int main()
{
ofstream writeFile("myFile.txt",ios::app); //input/creates text file for writing
writeFile<<"write this"; // writes that to text file
writeFile.Close(); // closes text file
ifstream readFile("myFile.txt",ios::app); // open myFile.txt for reading
string line = "";
getline(readFile,line,'~'); // reads file line by line and stores it in string line;
cout<<line;
system ("pause");
return 0;
}