xxxxxxxxxx
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
pid_t pid = fork();
if (pid == -1) {
perror("fork");
exit(EXIT_FAILURE);
}
if (pid == 0) { // Child process
char *args[] = {"/path/to/your/executable", NULL};
execve("/path/to/your/executable", args, NULL);
perror("execve"); // This line is reached only if execve fails
exit(EXIT_FAILURE);
} else { // Parent process
// Continue with the parent process
printf("Parent process continues...\n");
// ...
}
return 0;
}