Re: PHP and C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks -

On 07/17/2015 12:34 AM, German Geek wrote:
You cannot run a C program and grab input from PHP interactively! You would have to pipe the input
in as so:

// untested!
$number = `echo $someNumber | /var/www/TestScanf`;
echo 'number in php<br />';

Also, returning the number num in C's main function is wrong. You should return 0 if successful and
another int if the program has an error.



<snip>

You cannot run a C program and grab input from PHP interactively! You would have to pipe the input in as so:

// untested!
$number = `echo $someNumber | /var/www/TestScanf`;
echo 'number in php<br />';

Also, returning the number num in C's main function is wrong. You should return 0 if successful and another int if the program has an error.


CODE


$number = `echo $someNumber | /var/www/TestScanf`;
//$number = `/var/www/TestScanf`;
echo 'number in php<br />';

echo  $number;

OUTPUT


Notice: Undefined variable: someNumber in /var/www/Scanf.php on line 36
number in php
Enter your Number 0

TIA

Ethan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux