I want to read the file(.txt) line by line but not in while loop(once reading whole fle). Currently I am reading the file once as whole. BUT what I want to do is to read one line than go back to normal MAIN function than later on call
ReadDumpFile
and read the next line. Any help would be appreciated
NOTE:: Lines in .txt file are not same in size
Example
5:50:12:560:434, Rx, 7, 0x1E3, 00 80 2B 00 77 00 7D
5:50:12:560:615, Ax, 4, 0x760, 00 12 84 41
5:50:12:560:826, gc, 5, 0x2f1, 64 5A 43 20 4E
READ File function
readingLogFile(){
QString LFileName = "P_1.trc";
QFile logfile(LFileName );
QTextStream in(&logfile);
while (!in.atEnd())
{
QString fileLine = in.readLine();
if(fileLine.trimmed().isEmpty()!=true)
{
qDebug()<<fileLine;
}
}
}
What I have tried:
What i think i need to do is to keep previous line in pointer. And net time previous+1. but dont know how to read a specific line inside the document. if .txt file contain 1000000 line. how i can read line#670000 ???