Results 1 to 3 of 3

Thread: Problems executing system

  1. #1
    Join Date
    Apr 2010
    Posts
    13
    Qt products
    Qt3 Qt4 Qt/Embedded

    Default Problems executing system

    Hello , I am working with Qt in Linux and I would like to execute a comand and obtain the result of that comand and keep it in a String . I use the comand system but it returns 0 or 1 , but I am interested in obtaining the result of than comand.
    For example
    system("java -jar project.jar ")

    I would like to obtain the result of executing "java -jar project.jar" and keep it in a QString, but I only obtain 0 or 1.
    Thanks
    Gorka

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Problems executing system

    You can use QProcess, that system not portable.

    LE: correction: Linux has a system, sorry for my wrong intervention.
    Anyway you can give QProcess a try - it has more functionality (see the documentation link).
    Last edited by Zlatomir; 4th May 2011 at 11:28.

  3. #3
    Join Date
    Feb 2011
    Location
    Romania
    Posts
    53
    Thanks
    1
    Thanked 11 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problems executing system

    You can redirect stdout ( and stderr) to your file, then read the file content in QString

Similar Threads

  1. Replies: 8
    Last Post: 21st March 2011, 12:40
  2. Problems executing my exe in another pc
    By franco.amato in forum Installation and Deployment
    Replies: 5
    Last Post: 4th May 2010, 18:57
  3. Getting system wide X11 events problems
    By wandereq in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2010, 20:13
  4. Problems with executing the *.exe file
    By iksarp in forum Newbie
    Replies: 14
    Last Post: 28th February 2010, 05:49
  5. Transparency problems with system tray in Windows
    By lliehu in forum Qt Programming
    Replies: 2
    Last Post: 8th December 2007, 15:37

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.