PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
chrislee
Forum Newbie
Posts: 6 Joined: Fri Jul 25, 2003 8:21 pm
Post
by chrislee » Sun Aug 17, 2003 11:24 pm
Hi All,
I rrun the following program at Windows command prompt
c:\php\cli\php.exe input.php
<?php
print "Input:";
flush();
$fp = fopen("php://stdin", "r");
$input = fgets($fp);
fclose($fp);
echo $input;
?>
The program did not show out "Input:" and waiting for input after run!
Any hint to flush the output first?
I am using PHP 4.3.2 (cli) (built: May 28 2003 15:10:38)
derek
Forum Newbie
Posts: 17 Joined: Sat Aug 16, 2003 11:31 am
Post
by derek » Mon Aug 18, 2003 1:26 am
I've checked your program and for your convenience I execute the program on windows platform. It's working fine. You check it again and let me know.
chrislee
Forum Newbie
Posts: 6 Joined: Fri Jul 25, 2003 8:21 pm
Post
by chrislee » Mon Aug 18, 2003 1:59 am
derek,
I tried again, same result.
I am using Windows 2000 and PHP 4.3.2 (cli).
Which OS are you testing?
chrislee
Forum Newbie
Posts: 6 Joined: Fri Jul 25, 2003 8:21 pm
Post
by chrislee » Mon Aug 18, 2003 10:09 pm
I found the solution, use ob_flush() instead.