void Loadexternal ( char *emu, char *rom )
{
pid_t pid;
printf("%s %s \n", emu, rom);
if ((pid = fork()) == 0) {
char * const new_argv[] = { emu, rom, NULL };
if (execv(new_argv[0], new_argv) < 0) {
perror("execv error");
exit(EXIT_FAILURE);
}
} else if (pid < 0) {
perror("fork error");
exit(EXIT_FAILURE);
}
/* You really should use waitpid here so you know when the
* "emu" exits and you can startup the "frontend" again. */
if (waitpid(pid, NULL, 0) == -1) {
perror("waitpid error");
exit(EXIT_FAILURE);
}
printf("Exited successfully\n");
}
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
Copyright © 2026, NextGenUpdate.
All Rights Reserved.