I need to start a program from within a c++ program on linux, similar to what ShellExecute does on Windows. This program has to keep running even after the first program ends.
I found suggestions to use fork() and exec(), however these do not work for me as they create a child process that terminates when the parent process ends. I need to keep the new process running even after the parent has ended. Using system("") i have similar issues.
pid_t pid;
pid = fork();
char *arg[] = {"/home/pi/Robot/RobotUpdate", 0};
if (pid == 0)
execv("/home/pi/Robot/RobotUpdate", arg);
/home/pi/Robot/RobotUpdate is a c++ program that has to keep running after the first program has ended.
EDIT: solved with nohup command: system("nohup /home/pi/Robot/RobotUpdate &");