I am trying to learn C++ ifstream i came across this code on the net and have some question.
void read() {
ifstream inFile ("in.txt");
string l, i;
int item = 0;
while (getline (inFile, l)) { // is this one checking end of file like java?
istringstream linestream(l); // what does this one do?
while (getline (linestream, i, ' ')) {
item++;
if (item <= 3) {
initial.push_back(atoi(i.c_str()));
//atoi(i.c_str()) what is this?
// initial is a vector like ArrayList in java
}
else {
final.push_back(atoi(i.c_str()));
}
}
}
Thanks