Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <unistd.h>
- #include <stdio.h>
- #include <error.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <iostream>
- #include <cstring>
- #include <fstream>
- #include <sys/stat.h>
- #include <errno.h>
- #include <fcntl.h>
- #include <stdlib.h>
- using namespace std;
- #define MAXLINE 128
- #define FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
- #define FIFO1 "fifo.1"
- #define FIFO2 "fifo.2"
- int main(int argi, char **arg2)
- €
- int readrt
- ) size_t n=
- char f_str[MAXLINE];
- char s_str[MAXLINE];
- cout<<"Server is on"<<endl;
- unlink(FIFO1);
- unlink (FIFO2) ;
- -1, writert =
- if (mkfifo(FIFO1, FILE_MODE)==EEXIST)cout<<"\n Pipes is exist"<<endl;
- if (mkFifo(FIFO2, FILE_MODE.
- cout<<"Enter text:"<<endl;
- writert = open(FIFO2, O_WRONLY);
- if ((writert!=-1))
- while (1)
- {
- cin>>f_str;
- write(writert, f_str,strlen(f_str));
- readrt = open(FIFO1, 0_RDONLY);
- while ((n=read(readrt,s_str,MAXLINE))>0){
- s_str[n] =0;
- cout<<s_str<<endl;
- break;
- }
- if (strcmp(f_str, "exitor|')==0) break;
- EXIST)cout<<"\n Pipes is exist"<<endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement