Just use the c_str() member function like this:
BTW you would delete the memory like this:Code:#include <iostream> #include <string> using namespace std; int main(int argc, char *argv[]) { string xpdf_exec_comm ="dir"; system(xpdf_exec_comm.c_str()); return 0; }
And yes you could put that in main if you wanted.Code:if( ptr ) delete [] ptr;