Division Operator behaviour based on Datatypes in C language
We are already now that operators are used to perform certain operations on Operands. Now we are going to...
We are already now that operators are used to perform certain operations on Operands. Now we are going to...
Introduction: In our previous article, We have discussed about the Arithmetic Operators in C Language. In Today’s article, We are...
Introduction: We have discussed about the Operators in C Programming language so far. But what if we have more than...
Introduction: So far We have discussed about the building blocks of the C Programming Language. Like the datatypes, variables, keywords,...
C codes / In Depth Programs / IPC / Linux / Uncategorized
Pipe(Inter process Communication Event) Implementation in C Language :
1 |
#include"headers.h"<br />main()<br />{<br /> int p[2];int size,st;<br /> char buf[1000];<br /> bzero(buf,1000);<br /> pipe(p);<br /> printf("%d and %d are created by pipe..n",p[0],p[1]);<br /> int chldpid;<br /><br /> if((chldpid = fork()))<br /> {//client... parent...<br /> char file[20];<br /> printf("Enter File Name ..:");<br /> scanf("%s",file);<br /> size = strlen(file);<br /> write(p[1],&size,4);<br /> write(p[1],file,size);<br /> wait(&st);<br /> read(p[0],&size,4);<br /> read(p[0],buf,size);<br /> write(1,buf,size);<br /> }<br /> else<br /> {//child ... server ...<br /> int s,fd;<br /> int s2;<br /> read(p[0],&s,4);<br /> printf("Size in child ..%d n",s);<br /> char fname[20],*buff;<br /> bzero(fname,20);<br /> read(p[0],fname,s);<br /> printf("In child file name :%s..n",fname);<br /> fd=open(fname,O_RDONLY);<br /> if(fd &lt 0)<br /> {<br /> s2 = 26;<br /> write(1,"open failed..n",15);<br /> write(p[1],&s2,4);<br /> write(p[1],"Error File Doesn't Exist..",26);<br /> }<br /> else<br /> {<br /> s2 = lseek(fd,0,SEEK_END);<br /> buff =(char *) malloc(s2+1);<br /> lseek(fd,0,SEEK_SET);<br /> read(fd,buff,s2);<br /> close(fd);<br /> write(p[1],&s2,4);<br /> write(p[1],buff,s2);<br /> }<br /> exit(0);<br /> }<br /><br />}<br /> |
Check Character Program : Write a C Program to Check character is alphabet or number or a special character. The...
Introduction: Write a C program to check or detect given string is Palindrome or not ( Palindrome Program in C...
Introduction: The best way of learning programming language is by writing programs. Before we are going to write any program...
Datatypes List in C language : Data Type Format Specifiers Size Range Signed char %c 1Byte -128 to 127 Unsigned...
Introduction: In the previous article, We discussed about the Escape Sequences in C programming Language. In today’s article, We will...