Hi, I have been working on a simple command line program that will simply store my data in the code variable then submit that data to another program. Although I have the thory right, I don't understand why the middle double quote ( " ) seems to escape the quotes that surround the variable when it is used on the next line (variable: var).
So when I use the below code, I get the error "`[h]ref\` is not recognized as an internal or external command, operable program or batch file.". I don't understand why the quotation mark is escaping the string when it has been escaped twice and yes I have tried escaping it three times and just with the single slash. Can anybody see what is wrong with my script as I rarly use c++.
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
string code = "var_dump(preg_split('/(href\\=\\'|href\\=\\\"|[h]ref\\=)/is','adslkfajal;sdfjhref=test.com/test.htm'));";
std::string var = "C:\\z_php-gtk\\test4\\php-gtk2\\php -r \" "+code+" \"";
cout << code << endl;
system (var.c_str());
system("PAUSE");
return EXIT_SUCCESS;
}