Skip to content
Snippets Groups Projects
Commit 9e120632 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

nicer: use kill() instead of a system() call
parent b114d8ea
No related branches found
No related tags found
No related merge requests found
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <sys/types.h>
#include <signal.h>
int main(void) int main(void)
{ {
int i, pid; int i, pid;
FILE *fp; FILE *fp;
char str[32];
for(i = 0; i < 5; i++){ for(i = 0; i < 5; i++){
system("gmsh -pid fichier.msh fichier.pos > /tmp/gmsh.pid &"); system("gmsh -pid fichier.msh fichier.pos > /tmp/gmsh.pid &");
...@@ -18,7 +18,6 @@ int main(void) ...@@ -18,7 +18,6 @@ int main(void)
fscanf(fp, "%d", &pid); fscanf(fp, "%d", &pid);
fclose(fp); fclose(fp);
sprintf(str, "kill %d", pid); kill(pid, 9);
system(str);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment