Results 1 to 5 of 5

Thread: system() call external command, and get command resuld

  1. #1
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question system() call external command, and get command resuld

    hi everyone,

    in my program, i need to call an external command ("dmtxread") to decode a 2D barcode. and display the result.

    i can achieve above what i need by using system()
    Qt Code:
    1. system("dmtxread /home/cz/Webcam/abc.jpg >> /home/cz/Webcam/a.txt");
    To copy to clipboard, switch view to plain text mode 

    as you can see, i sent result into a text file (a.txt). after that, i used QFile read the content of a.txt as a string. then, display this string.

    i am just wondering is there any other way i can save the result to a buffer, or a string, directly, instead of creating a file to store the result, and read the content out.

    can anyone give me a hint or suggestion, please?
    thank in advance.

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: system() call external command, and get command resuld

    use QProcess and read the standard output into the string.

  3. #3
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: system() call external command, and get command resuld

    why you double post? there is no need for it. Already answered in newbie post.

  4. #4
    Join Date
    Jun 2009
    Location
    AKL | New Zealand
    Posts
    62
    Thanks
    21
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: system() call external command, and get command resuld

    Quote Originally Posted by MrDeath View Post
    why you double post? there is no need for it. Already answered in newbie post.
    thanks Mr death, i just want to make sure someone will read my post

    thanks for your reply. i will take a look QProcess

  5. #5
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: system() call external command, and get command resuld

    dont worry.. a single topic will attract more ppl. And will have much more discussion. So never duplicate your topic.

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.