I need to read the last line of file that is growing while some calculations are made. At the beginning there is no problem because the file is small, but when the file gets bigger the reading process is to slow.
while(!file.eof()){
if ((std::getline(file,line))){
std::istringstream iss(line);
std::istream_iterator<double> it(iss), end;
std::vector<double> v(it, end);
std::copy(v.begin(), v.end(), arr);
v.clear();
line.clear();
}
}
What is a more efficient way to read the last line of a file with out reading all the file until the end is reach?