我有下面的代码,但我需要exit(status)
返回一个浮点数但WEXITSTATUS
没有收到浮点数,因为状态必须是 int,请问有什么解决方案?
scanf("%f%f",&f,&g);
P = fork();
if(P == 0){
printf("\nje suis le fils multiplication: PID = %d\n", getpid() );
printf("mon pere: PID = %d\n", getppid() );
resultat2 = f * g;
exit(resultat2);
}else if(P < 0){
printf("FORK a echoue\t");
exit(EXIT_FAILURE);
}else{
printf("\nje suis le pere : PID = %d\n", getpid() );
printf("mon fils: PID = %d\n", P );
P = wait(&status);
if(WIFEXITED(status))
printf("le produit = %d \n", WEXITSTATUS(status));
}