• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

linux programmers...

crazeinc

Member
Any idea why the second exec isn't getting called?

int main(int argc, char* argv[]){
int fd[2];
pid_t child[2];
char *args[4];

if(argc != 3){
write(2,"Invalid # of arguments\n",23);
return 1;
}

args[0]="./generate1";
args[2]=argv[1];
args[3]=argv[2];
args[4]="0";

printf("parent: %ld\n",(long) getpid());

if(child[0] = fork())
child[1] = fork();

if(!child[0]){
printf("child: %ld\n",(long) getpid());
args[1]="even";
execvp(args[0],args);
}
if(!child[1]){
printf("child: %ld\n",(long) getpid());
args[1]="odd";
execvp(args[0],args);
}

return 0;
}

here's the output:
parent: 27052
child: 27053
0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38
child: 27054
 
Back
Top