Page 1 of 1

php passthru

Posted: Tue Jan 24, 2012 5:06 am
by dacenafan
i have a c++ file, compiled it into a .exe..

Code: Select all

#include<iostream>
#include<stdlib.h>
#include<conio.h>
using namespace std;

int main()
{
int a;
cin>>a;
cout<<a;
    return 0;
}
now, i want to run this using passthru and pass some input for int a..
i'm using this:

Code: Select all

echo passthru('2.exe && 5');
but this isnt working.. i'm getting garbage value.. any idea why ??

Re: php passthru

Posted: Wed Jan 25, 2012 1:12 am
by Christopher
passthru() sends the contents of the file to the browser. You should look at exec().