Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 = -1, writert = -1;
- size_t n=0;
- char f_str[MAXLINE];
- char s_str[MAXLINE];
- cout<<"Client is on"<<endl;
- while (1)
- {
- readrt = open(FIFO2, O_RDONLY,0);
- if(readrt!=-1)
- Cs
- while((n=read(readrt,f_str ,MAXLINE) )>0)
- {
- f_str[n]=0;
- cout<<f_str<<endl;
- break;
- }
- strcpy(s_str, "Client podtverdil");
- writert = open(FIFO1, O_WRONLY,0);
- write(writert, s_str, strlen(s_str));
- close(readrt);
- close(writert);
- +
- sleep(1);
- if (strcmp(f_str, "exitor") ==0) break;
- 7
- cout<<"Client is off";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement