note 20727 added to ref.readline
| From: | php-general at lists dot php dot net | Date: | Sun, 14 Apr 2002 11:17:08 +0000 |
| Subject: | note 20727 added to ref.readline | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29261@lists.php.net to get a copy of this message | ||
I wanted to get console input in a PHP script running on windows, so I made a little hack, which is
so simple, it is clearly public domain. What I did was write a C++ program to get a line, then
output it. Then all that is needed is to exec() that program and capture the output - readline()
for windows. The C++ source is as follows:
#include <iostream.h>
#include <string>
void main()
{
string input;
cin >> input;
cout << input;
}
It works wonderfully for my purposes, since I love the PHP language and want to have console input.
Justin Henck
--
http://www.php.net/manual/en/ref.readline.php
http://master.php.net/manage/user-notes.php?action=edit+20727
http://master.php.net/manage/user-notes.php?action=delete+20727
http://master.php.net/manage/user-notes.php?action=reject+20727