Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

wait system call

// C program to demonstrate working of wait()
#include<stdio.h>
#include<sys/wait.h>
#include<unistd.h>
 
int main()
{
    if (fork()== 0)
        printf("HC: hello from child
");
    else
    {
        printf("HP: hello from parent
");
        wait(NULL);
        printf("CT: child has terminated
");
    }
 
    printf("Bye
");
    return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #wait #system #call
ADD COMMENT
Topic
Name
1+6 =