PHP with C++
Posted: Tue Jun 15, 2004 4:44 am
Hello,
I am trying to use a php interface to call an executable compiled in C++.
I first succeeded in using the executable’s functions and store my results in text file.
Now I am trying to use only the memory models instead of files to manipulate my actions and results with my classes, but I don’t now how to figure out with. Any help would be welcome:
My php script is :
The C++ Classe :
Thinks !!!
feyd|use
I am trying to use a php interface to call an executable compiled in C++.
I first succeeded in using the executable’s functions and store my results in text file.
Now I am trying to use only the memory models instead of files to manipulate my actions and results with my classes, but I don’t now how to figure out with. Any help would be welcome:
My php script is :
Code: Select all
<?
//&op, &ent1, &ent2 are my variables putted in text zone in an html page
$op = $_POST['ComponantName'];
$ent1=$_POST['Diametre'];
$ent2=$_POST['Long'];
$handle = popen('fonction','w');
$contenu = "$op $ent1 $ent2";
//Fonction utilisé pour l'ecriture du flux
fwrite($handle, $contenu);
//Fonction utilisé pour la lecture du flux
echo "L'écriture de $contenu dans le fichier a réussi <br>";
pclose($handle);
?>Code: Select all
class Componant
{
int Diametre;
int Long;
public:
Componant();
virtual ~Componant();
};
The constructor:
Componant::Componant(int D, int L)
{
Diametre = D;
Long= L;
}
I use a function to create an instance of my class with the desired values :
void AddComponant(char name, int D, int L)
{
new Componant MyComponant = Componant(name,D,L);
}feyd|use
Code: Select all
andCode: Select all
tags.[/color]