I am having problems with the following short program I wrote with Qt 4.1.2
Qt Code:
#include <QString> #include <iostream> #include <QProcess> using namespace std; int main() { QString line; gzip->start("gunzip in.txt.gz -c"); while (gzip->waitForReadyRead()) { while (gzip->canReadLine()) { line = gzip->readLine(); ProcessLine( line ); } } } cout << line.toStdString(); }To copy to clipboard, switch view to plain text mode
my test file in.txt.gz contains the following all zipped
this is a test 1
this is a test 2
this is a test 3
this is a test 4
this is a test 5
this is a test 6
this is a test 7
this is a test 8
when I compile and run my code I get the following output.
this is a test 2
this is a test 3
this is a test 4
this is a test 5
this is a test 6
this is a test 7
this is a test 8
Notice that I have somehow lost the first line of the file.
every once in a while I do end up getting the first line.
Can someone Please tell me what's happing to the first line?
What is wrong with my code?
Bookmarks