PDA

View Full Version : Qprocess buffer to small?



xtreme
15th July 2008, 15:41
Hello,
I am trying to get a list of information from a program to my qt-program.
When receiving small amounts of data, there is no problem.
However when im receiving 500,000 bytes of tekst-information it crashes. I cannot find a single way to prevent this.
I am trying to buffer by using the following function:


void MainWindow::ViewDirReadStandardOutput()
{
qDebug() << ls->readLine() << ls->size();
if(ls->size() > 0){
ViewDirReadStandardOutput();
}
}

I am using qDebug to see how far the program gets, this would be replaced by a QStringlist when working.
Could anybody help me with this?

-Xtreme

wysota
15th July 2008, 16:15
This is not really how this method should look like... It should be a slot connected to a readyRead() signal and it should contain:


while(ls->canReadLine()){
qDebug() << ls->readLine();
}

xtreme
15th July 2008, 16:27
I have deleted the old code contents of the posted function and added
To the function where the ls process is created:


connect( ls, SIGNAL(readyRead()),
this, SLOT(storedata()) );

and


void MainWindow::storedata(){
while(ls->canReadLine()){
qDebug() << ls->readLine();
}
}

However it still crashes after about 400 lines.

wysota
15th July 2008, 16:40
Certainly not because of buffer overflow. If the buffer filled, the process would have stopped and waited until you would emptied it. I suggest you take a debugger and see where it crashes.

xtreme
28th July 2008, 09:11
Thanks for the reply. After debugging it (took a while to find out which debugger was the best) it appeared there was a read error function which made it crash.