Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include <stdio.h>
- #include <sys/types.h>
- //#include <sys/wait.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include<string.h>
- #include <unistd.h>
- int main(void){
- int pid=fork();
- if (pid>0){
- int lacze;
- char tekst[10]="tekst";
- if ((mkfifo("fifo",0600))==-1)
- printf("Blad (fifo)\n");
- lacze = open("fifo",O_WRONLY);
- if((write(lacze,tekst,10))==-1)
- printf("Blad (write)\n");
- close(lacze);
- unlink("fifo");
- }
- return 0;
- }
- zad6
- #include <stdio.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <string.h>
- #include <unistd.h>
- int main(void){
- int pid = fork();
- if (pid > 0) {
- int lacze;
- char tekst[10];
- lacze = open("fifo",O_RDONLY);
- if((read(lacze,tekst,20))==-1)
- printf("Blad (read)\n");
- printf("%s\n",tekst);
- close(lacze);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement