Solved Get large amounts of data from the command line.
-
Hi!
How do I get large amounts of data from the command line?
If I do this , I only get the last part of the data:ParserApi::ParserApi() { process = new QProcess(this); connect(process, &QProcess::readyReadStandardOutput, this, &ParserApi::reply); process->start(" php gopack.php check_fines " + numberCar + " 0"); } void ParserApi::reply() { QByteArray replyArray = process->readAllStandardOutput(); QJsonDocument doc = QJsonDocument::fromJson(replyArray); QJsonObject object1 = doc.object(); qDebug()<< doc;
-
Since readyReadStandardOutput is called more than once you first have to collect the data in your internal buffer.
-
Hi
you have your buffer as a local variable so for each "read" you only keeping the last data.
Move QByteArray replyArray;
to the class so its a member (ask if you dont know what that means)
and dovoid ParserApi::reply()
{
replyArray += process->readAllStandardOutput(); // add data to the member bufferand in ParserApi()
{
replyArray.clear(); // so you alreays start with clean buffer