Showing posts with label These programs are developed in unix.. Show all posts
Showing posts with label These programs are developed in unix.. Show all posts

Saturday, February 25, 2012

Write a program for character counter. (Sender and receiver both side)

/* Sender- Character count */

#include
#include
#include
#include
int main()
{
int pid,no,cnt=0;
char str[50],packet[100]="",*len;
system("clear");
len=(char *)malloc(sizeof(char));
pid=open("pipe",O_WRONLY);
printf("How Many Frames U Wnt To Enter : ");
scanf("%d",&no);
while(cnt/* Receiver - character count*/

#include
#include
#include
main()
{
int pid,cnt=0,len=0,i,k=1,j;
char packet[100],frame[100];
system("clear");
mkfifo("pipe",0666);
pid=open("pipe",O_RDONLY);
read(pid,packet,100);
printf("\nData Received Is : %s\n",packet);
while(packet[cnt]!=NULL)
{
len=packet[cnt]-48;
printf("\nFrame %d : ",k);
for(i=cnt+1,j=0;i