Here is just a simple example of reading a file with iostream. Just follow my comments to understand.
Good luck, sometimes newlines and spaces can mess you up, you may need to utilize an ignore() or something else.
#include <fstream>
#include <iostream>
using namespace std;
void evaluateFile(string ins); //Do something with the file contents
void readFile(); //Read the file
int main(){
readFile();
return EXIT_SUCCESS;
}
void readFile(){
ifstream input;
string fileName;
cout << "What is the full path of file to be read" << endl;
getline(cin, fileName); //Prompt user for filename, needs to be the fill path
input.open(fileName); //Open thhe file
if (input.fail()){ //Fail case
cout << "Sorry, cannot open file. Quitting now." << endl;
exit(0);
}
while(!input.eof()){ //Read file until the end of file is reached
string line;
getline(input, line);
evaluateFile(line);
}
input.close();
}
void evaluateFile(string line){
cout << line << endl;
//DO SOMETHING WITH THE FILE INPUT
}