Results 1 to 3 of 3

Thread: QProcess & Working with External Programs

  1. #1
    Join Date
    Dec 2010
    Posts
    14
    Thanks
    3
    Thanked 4 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QProcess & Working with External Programs

    Hey guys,

    I am looking to trigger an external program from my program in QT. However, this program is run through a command on Xterm and I need to include a reroute > to get the proper output File.

    e.x tifftopnm picturefile.tiff < picturefile.pnm

    Qprocess won't handle this since I am handing a Shell command to reroute. Is there an easy way to get around this or am I going about this wrong? Any help is greatly appreciated.

    Thank you guys,

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QProcess & Working with External Programs

    This should work:
    Qt Code:
    1. QProcess *proc = new QProcess(...);
    2. proc->setStandardOutputFile("picturefile.pnm"); // seems you want ">" and not "<"
    3. proc->start("tifftopnm", QStringList() << "picturefile.tiff");
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2010
    Posts
    14
    Thanks
    3
    Thanked 4 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess & Working with External Programs

    Wysota,

    Thank you for taking the time to reply. I am pretty new to QT and had been focused so much on that, i failed to see my mistake in Linux syntax. One quick question for you, before I got a response I had changed my code to call a statement ( "tifftopnm filename.tiff > filename.pnm") . Is there any drawback to using the statement () expression instead of creating a QProcess?

Similar Threads

  1. QProcess - How show/hide external application
    By markvi in forum Qt Programming
    Replies: 1
    Last Post: 7th January 2010, 14:42
  2. Replies: 1
    Last Post: 1st December 2008, 21:02
  3. Calling external programs?
    By Hossie in forum Qt Programming
    Replies: 12
    Last Post: 17th May 2008, 17:19
  4. QProcess and console programs
    By bond_e in forum Qt Programming
    Replies: 10
    Last Post: 13th July 2007, 08:39
  5. How to communicate with external programs?
    By deekayt in forum Qt Programming
    Replies: 7
    Last Post: 27th October 2006, 23:01

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.