I'm doing a program where I need user to enter the name of a text file. I want him to be able to see the path if he enters pwd.
Right now this is very OS related and only works on Mac OS(I guess). So I have done

string real;
getline(cin,real);
    if (real == "pwd")
    {
        execl("/bin/pwd","pwd",(char*)NULL);
        wait(1);
    }

My problem is that I want this function to output the full path and then return input to the user so he can decide what to type in next but the shell command runs and then the program stops. Is there any way to basically "sneak" the shell command in there , make it run and then return to the program?

I believe that popen will do what you want. Here is some documentation with an example at the bottom of the page.

Fantastic! this is exactly what I was looking for. Thank you L7Sqr :D