Just use the c_str() member function 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;
}
BTW you would delete the memory like this:

Code:
if( ptr ) delete [] ptr;
And yes you could put that in main if you wanted.