send PHP string to C++
<p>I am trying to pass over from php a string into C++, i managed to figure out how to pass numbers, but it doesn't work for letters. Here's what i have that works for PHP</p>

<pre><code>&lt;?php 



$r = 5; 
$s =  12;
$x= 3;  
$y= 4; 
$q= "Hello World"; 
$c_output=`project1.exe $r $s $x $y $q`; // pass in the value to the c++ prog 
echo "&lt;pre&gt;$c_output&lt;/pre&gt;"; //received the sum 
 //modify the value in php and output 
echo "output from C++ programm is" . ($c_output + 1);

?&gt; 
</code></pre>

<p>This sends the variables r,s,x,y, and q to the C++ programm project1.exe and IT WORKS, but the problem is that it doesn't work for the string variable $q.</p>

<p>Here's the code that I have in my C++ programm, it's simple:</p>

<pre><code>#include&lt;iostream&gt; 
#include&lt;cstdlib&gt; 
#include&lt;string&gt;
using namespace std;
int main(int in, char* argv[]) { 
 int val[2]; 
 for(int i = 1; i &lt; in; i++) { // retrieve the value from php 
  val[i-1] = atoi(argv[i]); 
 }  
 double r = val[0];
double s = val[1];
double x = val[2];
double y = val[3];

double q = val[4]; // here's the problem, as soon as i try to define val[4] as a string or char, it screws up
 cout &lt;&lt; r;
 cout &lt;&lt;s;
cout &lt;&lt; x;
cout &lt;&lt; y;
cout &lt;&lt; q;

  // will output to php 
 return 0; 

 } 
</code></pre>

<p>It works, but for the string "Hello world" which i pass through $q from PHP doesn't give me the string back (i know it's defined as a double, but as soon as i try to change it to a string or a char variable the code just doesn't compile). </p>

<p>Please explain to me how i have to go around this problem so that $q can be processed as a string. FYI, I am a newbie to programming (6 months in).</p>
