22.07.2013 Views

Download File

Download File

Download File

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

fclose(f); //closing file<br />

//creating msg q id<br />

if((msg_id=msgget(key,IPC_CREAT|0644))==-1)<br />

perror("\nUnable to get message id...");<br />

else<br />

printf("\nmsgid=%d",msg_id);<br />

/*writing message to the q */<br />

if((x=msgsnd(msg_id,&msg_obj1,strlen(msg_obj1.msg_data),IPC_NOWAIT))<br />

==-1)<br />

perror("\nUnable to send message...");<br />

else<br />

printf("\nSend Msg Success : return %d",x);<br />

}<br />

return 0;<br />

/*<br />

Compiling………….<br />

$CC msgsndQ.c -o msgsndQ<br />

Execution…………..<br />

$msgsndQ <br />

*/<br />

NP Lab Manual , RNEC page: 13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!