Results 1 to 4 of 4

Thread: exit /b 23 in a .bat file returns 0 from QProcess::exitCode

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2012
    Posts
    5
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11 Android Maemo/MeeGo
    Thanks
    2

    Default exit /b 23 in a .bat file returns 0 from QProcess::exitCode

    I have a batch file (ppp.bat) with only two lines in it:
    Qt Code:
    1. start .
    2. exit /b 23
    To copy to clipboard, switch view to plain text mode 

    The C++ code to call QProcess::start is this:

    Qt Code:
    1. QString program = "c:\\ppp.bat";
    2.  
    3. QProcess *myProcess = new QProcess(this);
    4.  
    5. myProcess->start(program);
    6. myProcess->waitForStarted();
    7.  
    8. myProcess->waitForFinished(1000);
    9.  
    10. QString strExitCode( "ExitCode is %1 ExitStatus is %2");
    11.  
    12. strExitCode = strExitCode.arg( myProcess->exitCode()).arg( (int) myProcess->exitStatus());
    13.  
    14. ui->textEdit->append( strExitCode);
    To copy to clipboard, switch view to plain text mode 


    It always prints 0 for exitCode.

    What is needed to have this function return 23?

    Oh the OS is Windows XP SP 3 and the Qt is 4.8.1 compiled with VS2010.

    Thanks.
    Last edited by Agroni; 14th September 2012 at 15:24.

Similar Threads

  1. Replies: 1
    Last Post: 19th August 2012, 17:08
  2. Ping and QProcess (exitcode() question)
    By hakermania in forum Qt Programming
    Replies: 3
    Last Post: 30th August 2011, 23:29
  3. QProcess.pid() returns wrong pid in PyQt(windows)
    By vertusd in forum Qt Programming
    Replies: 1
    Last Post: 16th April 2011, 07:57
  4. Question about QProcess::ExitCode() !
    By jackmack in forum Qt Programming
    Replies: 1
    Last Post: 30th July 2010, 09:38
  5. exitCode problem in QProcess
    By mattia in forum Newbie
    Replies: 7
    Last Post: 26th November 2007, 15:09

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.