Search
 
SCRIPT & CODE EXAMPLE
 

C

c fork wait for child

int main(){
    pid_t pid = fork();
    if (pid == 0) {
        printf("HC: hello from child
");
        exit(17);
    } else {
        int child_status;
        printf("HP: hello from parent
");
        waitpid(pid, &child_status, 0); // Waits for child to end
        printf("CT: child result %d
", WEXITSTATUS(child_status));
    }
    printf("Bye
");
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: check prime number or not c 
C :: get last char string c 
C :: c random array 
C :: mariadb utf8mb4 
C :: typedef pointer 
C :: take long long input in c 
C :: how to make a linked list in c 
C :: go optional parameters 
C :: goto statement in c 
C :: accessing elements of 1d array using pointers 
C :: set value of boolean in c 
C :: Convert mpg / mp4 to gif with ffmpeg 
C :: format specifiers in c 
C :: plt legend top right outside 
C :: struct main function c in unix 
C :: c convert float to string 
C :: c pointers 
C :: syntax 
C :: variables in c 
C :: print float number completely in C language 
C :: c language float user input 
C :: how to select numeric columns in r 
C :: c check if character is upper case 
C :: strstr 
C :: ternary operator in c 
C :: node in c 
C :: bp result system 
C :: arduino internal pull up resistor 
C :: C++ How to use enums for flags? 
C :: reverse a number in c 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =