Download File

Download File Download File

mycnis.weebly.com
from mycnis.weebly.com More from this publisher
22.07.2013 Views

Subject: NETWORK PROGRAMMING LAB Year : 2010 Class : IV B-Tech C.S.E Semester: First Aim: Implement the FIFO form of IPC /* file name makefifo.c */ # include # include # include # include int main() { int fd; char buff[100]; /*creating FIFO */ if((mkfifo("./MyFifo",S_IFIFO|S_IRWXU|S_IRWXG|S_IRWXO))0) printf("%s",buff); /*creating write process */ fd=open("./MyFifo",O_WRONLY); write(fd,"Hello world",12); close(fd); } /* Compiling…………. $ cc makefifo.c – o makefifo Execution………….. $ makefifo */ NP Lab Manual , RNEC page: 10

Output: [student@localhost ~/khan]$ vi makefifo.c [student@localhost ~/khan]$ cc makefifo.c -o makefifo [student@localhost ~/khan]$ ./makefifo [student@localhost ~/khan]$ ./makefifo mkfifo error...: File exists NP Lab Manual , RNEC page: 11

Subject: NETWORK PROGRAMMING LAB Year : 2010<br />

Class : IV B-Tech C.S.E Semester: First<br />

Aim: Implement the FIFO form of IPC /* file name makefifo.c */<br />

# include <br />

# include <br />

# include <br />

# include <br />

int main()<br />

{<br />

int fd;<br />

char buff[100];<br />

/*creating FIFO */<br />

if((mkfifo("./MyFifo",S_IFIFO|S_IRWXU|S_IRWXG|S_IRWXO))0)<br />

printf("%s",buff);<br />

/*creating write process */<br />

fd=open("./MyFifo",O_WRONLY);<br />

write(fd,"Hello world",12);<br />

close(fd);<br />

}<br />

/*<br />

Compiling………….<br />

$ cc makefifo.c – o makefifo<br />

Execution…………..<br />

$ makefifo<br />

*/<br />

NP Lab Manual , RNEC page: 10

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

Saved successfully!

Ooh no, something went wrong!