One thought is the stdio
synchronization might be slowing you down. That can be turned off. I don’t know if that would account for all of the difference, but you could try. Also, you’re not using eof()
correctly. Finally, I’d use the std::string version of getline()
std::ios::sync_with_stdio(false);
ifstream ifs("/sdcard/testfile.txt");
std::string line;
while (getline(ifs, line))
{
LOGD(line);
}
I haven’t tested this code, but you can try it and see if it makes a difference.