Quick system() question

I have a program which calls vim, allows the user to edit a file, and then returns to the program. For the moment I just to system ("vim new") but this produces a crash. Mustn't I pause something before I return to my program?

int main()
{
system("vim new");
cout << "vim done" << endl;
return 0;
}


Amma, the above is a sample program which works perfectly right. By the way what is the OS you are working on?
Please don't use the system() function; if you want to know why (and you should) you can read here: http://www.cplusplus.com/forum/articles/11153/

If you want the program to be done the Right Way (that is, safely, securely and efficiently) you should use the fork(), exec?() and waitpid() functions:
fork(): http://linux.die.net/man/2/fork
exec?(): http://linux.die.net/man/3/exec
waitpid(): http://linux.die.net/man/2/waitpid
Topic archived. No new replies allowed.