#define _POSIX_C_SOURCE 1 #include #include #include #include #include #include "chiffres.h" #include "exit_if.h" char *nom_unique(char *suffixe) { pid_t pid = getpid(); int taille_pid = chiffres(pid); int l = strlen(taille_pid + suffixe + 3); char *nom = malloc(l); if (nom == NULL) PERROR_AND_EXIT(); snprintf(nom, l, "_%d_%s", pid, suffixe); return nom; }