Web lists-archives.com

[PHP] PHP and C




Dear list -

PHP script calls a C program --




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html>
    <head>
        <!--  Scanf.php  -->
        <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
        <style>
            body{
                background-color: #89caeb;
                width:100%;
                height:100%;
                position: relative;
                   font-family: "Helvetica", "Arial" , "Liberation Sans", "Free sans", sans-serif;
                overflow-y: scroll;
             }
            .wgh{
                font-size: 14pt;
                align: center;
                font-weight: bold;
            }

        </style>
    </head>
        <body>


<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
error_reporting(E_ALL | E_NOTICE);
ini_set('display_errors','1');


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

echo  $number;

?>
        </body>
</html>


//TestScanf.c //works perfectly as a stand alone
#include <stdio.h>

int main(void)
{
    int num;

    printf("Enter your Number  ");
    scanf("%d", &num);

    printf("%d\n", num);
    return (num);

}

Output -

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