Hi all,

yes, Qt3 and Windows. Pita but can't help it. Hope there's a Qt veteran around...

Problem in short: Can't read from a php script's stdout.

At length:
I have used QProcess often and successfully, and for running php scripts, too.
But do so and communicate via stdin/stdout is a first.

From this
Qt Code:
  1. QProcess process_;
  2. process_.clearArguments();
  3. process_.addArgument("cmd");
  4. process_.addArgument("/C");
  5. process_.addArgument("type " + anyfile);
To copy to clipboard, switch view to plain text mode 
or even this (path omitted for brevity)
Qt Code:
  1. QProcess process_;
  2. process_.clearArguments();
  3. process_.addArgument("php");
  4. process_.addArgument("-h");
To copy to clipboard, switch view to plain text mode 
I can read from stdout just fine, connecting to SIGNAL(readyReadStdout()).

Also, when I execute this "test.php" script from a DOS box
Qt Code:
  1. <?php
  2. //$line = trim(fgets(STDIN));
  3. echo "foo";
  4. fprintf(STDOUT, "%s", "bar");
  5. ?>
To copy to clipboard, switch view to plain text mode 
it writes out "foobar" as expected.

However, running (again, paths omitted for brevity - QDir::convertSeparators() used but changes nothing)
Qt Code:
  1. QProcess process_;
  2. process_.clearArguments();
  3. //process_.addArgument("cmd"); //command interpreter makes no difference
  4. //process_.addArgument("/C");
  5. process_.addArgument("php");
  6. process_.addArgument("test.php");
  7. //process_.addArgument("php test.php"); //no matter if 1 or 2 args
To copy to clipboard, switch view to plain text mode 
the very same slot that got called before now is never executed.

I don't even know if it's a QProcess limitation, or a php one, or how I could make sure of one or other.

Any idea? Thx.