Results 1 to 1 of 1

Thread: QProcess question

  1. #1
    Join Date
    May 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question QProcess question

    Hi everyone,

    The code I am writing uses QProcess to send text to an external script for further processing. I am testing it now with a simple PHP script. The problem I have is that the PHP script doesn't seem to know when I have finished sending text to it.

    the last bit of my c code that sends the text does the following:

    proc->write("\n");
    proc->closeWriteChannel();
    }

    the PHP script is a command line script that looks like so:

    Qt Code:
    1. <?php
    2. error_reporting(E_ERROR);
    3.  
    4. $writefile = fopen($argv[1],'w');
    5. if(!$writefile)
    6. {
    7. echo "Error Opening Text File.\n";
    8. exit;
    9. }
    10. else
    11. {
    12. $stdin = fopen('php://stdin', 'r');
    13. $line = fgets($stdin); // reads one line from STDIN
    14. while(!feof($line))
    15. {
    16. fwrite($writefile,$line);
    17. $line = fgets($stdin); // reads one line from STDIN
    18. }
    19. fwrite("got to here");
    20. }
    21. fclose($writefile);
    22. ?>
    To copy to clipboard, switch view to plain text mode 

    The script above just captures what is coming in from STDIN and dumps it to a text file. What seems to be happening is that the php script never seems to see the EOF. It never gets out of the while loop. I am at a loss as to which code is misbehaving. Does anyone know if closeWriteChannel() sends out an EOF? If not, is there a way to do so? How can I get my script to recognize that the pipe is closed?

    I realize this isn't a PHP help forum, but I had to start looking for help somewhere. Any ideas are greatly appreciated.

    Thanks
    Paul
    Last edited by PH5; 4th February 2010 at 23:57.

Similar Threads

  1. QProcess StdErr signal question
    By devx in forum Qt Programming
    Replies: 4
    Last Post: 25th November 2009, 18:15
  2. question on QProcess
    By wagmare in forum Qt Programming
    Replies: 3
    Last Post: 17th January 2009, 07:23
  3. QProcess question
    By lni in forum Qt Programming
    Replies: 3
    Last Post: 19th July 2007, 19:06
  4. Question about QProcess
    By lni in forum Qt Programming
    Replies: 5
    Last Post: 27th April 2007, 23:08
  5. QProcess Question
    By Vash5556 in forum Qt Programming
    Replies: 1
    Last Post: 26th February 2007, 16:24

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.