Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Get large amounts of data from the command line.

Get large amounts of data from the command line.

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 284 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by
    #1

    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;
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Since readyReadStandardOutput is called more than once you first have to collect the data in your internal buffer.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      4
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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 do

        void ParserApi::reply()
        {
        replyArray += process->readAllStandardOutput(); // add data to the member buffer

        and in ParserApi()
        {
        replyArray.clear(); // so you alreays start with clean buffer

        1 Reply Last reply
        4

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved