Spicyztrickz

Loot Tricks, Free Recharge Tricks, Paytm, Mobile Offer 2019, Unlimited Paytm Cash, Highest Paying Latest Apps & Websites. Best Deals Of The Day.

palindrome using fifo || C program

Fifo_Creation.c

#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

int main(){
 int n,fd,fg,i;
 //int *p;
 char b[20];
 mkfifo("myfifo1",0666);
 fd = open("myfifo1", 1);
 printf("Enter the string:"); 
 scanf("%s",b);
 //p = &n;
 write(fd,(void *)&b, strlen(b)+1);
 
 close(fd);
}

Fifo_access.c

#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

int main(){
 int k,fd,j,i=0;
 int mask = 32768;
 fd = open("myfifo1", 0);
 char a[20];
 k = read(fd, (void *)&a, sizeof(a));

 for(i=0, j = k-2; i < j; i++, j--){
  if(a[i] == a[j])
   continue;
  else
   break;
 }

 if(i>=j){
  printf("Palindrome\n");
 }
 else{
  printf("Not Palindrome\n");
 }
 close(fd);
 
}


Post a Comment

[disqus]

MKRdezign

{facebook#https://www.facebook.com/12brahma/} {twitter#https://twitter.com/brahmasanidipak} {google-plus#https://plus.google.com/118318150044608348295} {pinterest#https://in.pinterest.com/spicyztrickz/} {youtube#YOUR_SOCIAL_PROFILE_URL} {instagram#YOUR_SOCIAL_PROFILE_URL}

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget