Reputation: 230
I know that execlp replaces the current process.I am trying to run
execlp("mpg123", "mpg123", "-q", "1.mp3", 0);
Is there any way i can keep the program running while execlp executes?
Upvotes: 1
Views: 1342
Reputation: 409166
You fork
a new process, and do the exec
call in the child process:
pid_t child_pid = fork();
if (child_pid == -1)
perror("fork");
else if (child_pid == 0)
{
/* In child process, call `exec*` */
}
else
{
/* In parent process, continue doing... things... */
}
Upvotes: 3