I call a function that will branch and execute the code of another process for me. There are several processes designated B, C, and D. I have almost identical code for creating different processes. For some bizarre reason that I cannot reveal, one of the functions of creating a process causes a segmentation error. They look like me. Any chance anyone can weigh can give me some idea of what the problem is?
void spawn_process_b(int fileID[]){
int pid;
char * argv[2];
sprintf(argv[0], "%d", fileID[0]);
sprintf(argv[1], "%d", fileID[1]);
pid = fork();
if (pid == 0)
{
execv("PipeW1", argv);
}
}
void spawn_process_c(int fileID[]){
int pid;
char * argv[2];
sprintf(argv[0], "%d", fileID[0]);
sprintf(argv[1], "%d", fileID[1]);
pid = fork();
if (pid == 0)
{
execv("PipeW2", argv);
}
}
cout < "bp1" < ; , , spawn_process_b . spawn_process_c , segfault sprintf. - ? spawn_process_b , ... ... , . , ?