i got some project here...
my program have to send data to ISA port,
i made a program using C language (i use linux machine,apache,php)
and when i run that program by command line...i get good result like i
want...
the problem is that program have to run by webpage...
i hope this program can run in server or client side ..(when i use php
script it won't run well :( )
so does anybody can help me to make javascript from my C program...? or
php script (server side) coz when i using exec,shell_exec,system,passthru
function the result is nothing....
it's my list program in c...
coba.c compile to execute program coba
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <asm/io.h>
int main(int argc, char **argv)
{
int terminal,angka;
static int client[8] = {0x3e0,0x3e4,0x3e8,0x3ec,0x3a0,0x3a4,0x3a8,0x3ac};
static int no_disp[10]={0x03,0x3f,0x52,0x32,0x2e,0xa2,0x82,0x3b,0x02,0x22};
terminal = atoi(argv[1]);
angka = atoi(argv[2]);
ioperm(0x3e0,16,1);
ioperm(0x3a0,16,1);
ioperm(0x3b0,16,1);
setuid(0); /* if we're setuid, do it really */
if(ioperm(client[terminal-1]+3,16,1)) {perror("ioperm()");exit(1);}
outl(0x80,client[terminal-1]+3);
if(ioperm(client[terminal-1]+1,16,1)) {perror("ioperm()");exit(1);}
outl(no_disp[angka%10],client[terminal-1]+1);
if(ioperm(client[terminal-1]+3,16,1)) {perror("ioperm()");exit(1);}
outl(0x80,client[terminal-1]+3);
if(ioperm(client[terminal-1]+1,16,1)) {perror("ioperm()");exit(1);}
outl(no_disp[(angka%100)/10],client[terminal-1]+1);
if(ioperm(client[terminal-1]+3,16,1)) {perror("ioperm()");exit(1);}
outl(0x80,client[terminal-1]+3);
if(ioperm(client[terminal-1]+1,16,1)) {perror("ioperm()");exit(1);}
outl(no_disp[(angka%1000)/100],client[terminal-1]+1);
return argc;
}
and this is my php script that won't run well :(
run.php
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?
$program1="/usr/local/apache/htdocs/customer/cpp/coba 8 3";
passthru($program1);
exec($program1);
system($program1);
shell_exec($program1);
?>
</body>
</html>
sorry if my english is not good....
trio