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. QProcess: Not reading ONLY std::cerr

QProcess: Not reading ONLY std::cerr

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 1 Posters 465 Views
  • 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.
  • F Offline
    F Offline
    fem_dev
    wrote on last edited by
    #1

    Inside my main application, I'm trying to read the QProcess standard output (std::cout) and standard error (std::cerr).

    With this code below I aready can read the standard output, but I don't get the standard error. Why?

    _process = new QProcess(this);
    
    // Read std::cout
    connect(_process, &QProcess::readyReadStandardOutput, [&]() {
        auto data = _process->readAllStandardOutput();
        ui->console_txt->appendPlainText(data);
    });
    
    // Read std::cerr
    connect(_process, &QProcess::readAllStandardError, [&]() {
        auto data = _process->readAllStandardError();
        ui->console_txt->appendPlainText(data);
    });
    

    Why is this happening?

    F 1 Reply Last reply
    0
    • F fem_dev

      UPDATE 1:
      In the Qt Creator IDE console, I got this message about the std::cerr code in compile time:

      QObject::connect: signal not found in QProcess
      

      How can I fix it?

      F Offline
      F Offline
      fem_dev
      wrote on last edited by
      #3

      @fem_dev I found my error:

       &QProcess::readyReadStandardError
      
      1 Reply Last reply
      2
      • F fem_dev

        Inside my main application, I'm trying to read the QProcess standard output (std::cout) and standard error (std::cerr).

        With this code below I aready can read the standard output, but I don't get the standard error. Why?

        _process = new QProcess(this);
        
        // Read std::cout
        connect(_process, &QProcess::readyReadStandardOutput, [&]() {
            auto data = _process->readAllStandardOutput();
            ui->console_txt->appendPlainText(data);
        });
        
        // Read std::cerr
        connect(_process, &QProcess::readAllStandardError, [&]() {
            auto data = _process->readAllStandardError();
            ui->console_txt->appendPlainText(data);
        });
        

        Why is this happening?

        F Offline
        F Offline
        fem_dev
        wrote on last edited by fem_dev
        #2

        UPDATE 1:
        In the Qt Creator IDE console, I got this message about the std::cerr code in compile time:

        QObject::connect: signal not found in QProcess
        

        How can I fix it?

        F 1 Reply Last reply
        0
        • F fem_dev

          UPDATE 1:
          In the Qt Creator IDE console, I got this message about the std::cerr code in compile time:

          QObject::connect: signal not found in QProcess
          

          How can I fix it?

          F Offline
          F Offline
          fem_dev
          wrote on last edited by
          #3

          @fem_dev I found my error:

           &QProcess::readyReadStandardError
          
          1 Reply Last reply
          2

          • Login

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