execute program in a new terminal

Hello, so I need to code a line in C++ which opens a compiled program in a new terminal..
this :

execv ("gnome-terminal -e" , (char* const*) "./myprogram" );

doesn't work, it exits -instantly- the new terminal which means it didn't execute correctly the program.. because the program it executes tells him that it should wait for input..
anyone knows why and how to fix it?
Last edited on
That cast doesn't look right. Try something like this:
1
2
const char* argv[] = {"./myprogram", NULL};
execv ("gnome-terminal -e" , argv);
You shouldn't cast away error messages.
RTFM to know what the arguments should be. It also indicates how to know if there was an error.
Topic archived. No new replies allowed.