
Kwokcheung H. answered 01/16/17
Tutor
5
(15)
Current Software Engineer, part-time master student.
i am not sure if i understand your question correctly, but here is how you read in a file in C++.
you first have to include
#include <fstream>
then your main function can look like this
ifstream file("fileName"); --< read the file here
string line; --<declare a file type for processing the file later on
while(getline(file, line)) { // as long as there is still a line
cout << line << endl; //print out the line with the data type of string
}
file.close();
string line; --<declare a file type for processing the file later on
while(getline(file, line)) { // as long as there is still a line
cout << line << endl; //print out the line with the data type of string
}
file.close();