You are here: Re: exec « PHP Language « IT news, forums, messages
Re: exec

Posted by C. on 01/24/08 13:45

On 22 Jan, 11:55, "Jean Pierre Daviau" <O...@WasEno.ugh> wrote:
> Hi everyone,
>
> I am trying to capture the output from an exe that takes a file
> and output the counted words.
> ex:
> Usage: krx60410 < file
> Total Words : 103
> 8 de
> 7 la
> 4 culture
> 4 qui
> -------- snip ------------
>
> I tried the folowing wich doe not work has you gessed.
>
> $input = file($fichier);
> $output = exec("tree_words.exe < $input", fgets(STDOUT));
> echo $output;
>

I/O redirection expects a file - so unless $fichier is the name of a
file containing another filename you're doing something whacky here
which will not work. Surely you mean to do this:

$output = exec("tree_words.exe < $fichier", $real_output);

I have no idea what you're trying to do with fgets(STDOUT) which
doesn't even make sense on its own in PHP (the std streams exist but
have to be explicitly opened - there is no guarantee that the resource
will have a specific value therefore cannot be referenced using a
constant.

C.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация