Re: EOF: how to generate one in a string

From: Date: Wed, 08 Jan 2003 09:11:36 +0000
Subject: Re: EOF: how to generate one in a string
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-130727@lists.php.net to get a copy of this message
----- Original Message ----- From: "Jean-Christian Imbeault" <jc@mega-bucks.co.jp> To: <php-general@lists.php.net> Sent: Wednesday, January 08, 2003 9:52 AM Subject: [PHP] EOF: how to generate one in a string > I am trying to use a command line program in Linux using this form: > > $result = /path/prog $arg; > > But this doesn't work as the program is expecting and EOF that never comes. > > If I use the program on the command line when I am finished entering all > the data I need to hit return and then CTRL-D to give an EOF. > > How can I simulate this using the backticks? If $arg is, what you would enter in the command line, you need to pass it to prog's stdin. You could use echo "$arg" | /path/prog for example. If $arg is more that just a single line w/o special characters, you should probably use popen for more control (is it popen in php?...)

« previous php.general (#130727) next »