Re: Passing an array to a C program from a php script??
| From: | mailing_list at gmx dot at | Date: | Tue, 26 Jun 2001 06:38:35 +0000 |
| Subject: | Re: Passing an array to a C program from a php script?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55208@lists.php.net to get a copy of this message | ||
> Hi all,
>
> I have a big array (nearly 1000 lines) that I would like to pass to a C
> program. I don't want to create a temporary file to pass my array (If
> possible ?!?), and I don't think the command line will fit my needs.
>
> Is there a way to execute a program with a php string as the standard
> input. Something like shell redirection 'c_program < input.file' but with
> input.file being a php variable and not a real file ?? Any other solution
> ??
>
> Hope I am clear enough !
what you can do is serialize the array and then parse it with you c-program
(it is not very difficult, to get the syntax ;-) ):
popen($fh,"|my_c_program");
pwrite($fh,$serialized_array);
pclose($ph);
(hope that was what you were asking)
michi
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
--
GMX Tipp:
Machen Sie Ihr Hobby zu Geld bei unserem Partner 1&1!
http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a