waitpid behaving strange...
hi, my waitpid is behaving really strange can u see what im dooing wrong?
(when my background processes are finished it prints out pid as 1 instead of the real pid and it never does the else part)
Code:
while(pid = waitpid(-1, &status, WNOHANG) > 0){
if (WIFEXITED(status)){
printf("bakgrundsprocess med pid: %i har avslutats!\n", pid);
}
else {
printf("bakgrundsprocess med pid: %i lever!\n", pid);
}
}
ps. do you need to see my whole program?
ps2. thanks for helping me I really appreciate it!