Results 1 to 2 of 2

Thread: pipe in a QByteArray to a QProcess

  1. #1
    Join Date
    Aug 2009
    Location
    LOL Land
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default pipe in a QByteArray to a QProcess

    I have an QByteArray with binary data. I want to "pipe" it into a new QProcess, so the process takes it as stdin.

    I'm really just stuck with this and could really use the help.

    btw, writing to a temp file isnt acceptable because this is going to be done millions of times as this is a database related app.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: pipe in a QByteArray to a QProcess

    As a QIODevice, QProcess inherits a method to write a QByteArray to the process:
    QIODevice::write(const QByteArray & byteArray )

    You should be able to just write to the QProcess instance and then, depending on the needs of the process, call void QProcess::closeWriteChannel ().

    If you are going to do this millions of times then you probably want a single, persistent sub-process or you'll have millions of process startup delays.

Similar Threads

  1. QFileDialog to stderr: Couldn't open named pipe (2)
    By Ballig in forum Qt Programming
    Replies: 0
    Last Post: 17th January 2010, 13:30
  2. Replies: 9
    Last Post: 25th July 2009, 13:27
  3. pipe tail -f to Qlistbox realtime
    By unclecameron in forum Qt Programming
    Replies: 3
    Last Post: 10th December 2008, 23:39
  4. How to pipe QMessages into my ui.TextEdit?
    By DigiDrag in forum Newbie
    Replies: 4
    Last Post: 2nd September 2008, 21:19

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.