Design and Develop program for creating a private message queue.
AIM:
Design and Develop program for creating a private message queue.
Program:
#include<stdio.h> #include<sys/types.h> #include<sys/ipc.h> #include<sys/msg.h> void main() { int queue_id; /*create a private messaga queue,with access only to the owner*/ queue_id=msgget(IPC_PRIVATE,0600); if(queue_id==-1) { perror(“msgget”); exit(1); } printf(“message queue ID=%d\n”,queue_id); }
Output:
guest-b7wxtw@ubuntu:~$gcc –o message.out message.c guest-b7wxtw@ubuntu:~$./message.out message queue ID:32769
-
UpdatedOct 23, 2014
-
Views2,221
You May Like
Write a Shell script to find factorial of a given integer.
Write in C the following Unix commands using system calls A). cat B). ls C). mv
Write a Shell script that displays list of all the files in the current directory to which the user has read, Write and execute permissions.
Write a Shell script that accepts a filename, starting and ending line numbers as arguments and displays all the lines between the given line numbers.
Write a C program to emulate the Unix ls-l command.
Write a Shell script to list all of the directory files in a directory.