Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- int main(){
- int potok_fd;
- int deskryptor;
- int licznik; //ile bajtow
- char bufor[8];
- char nazwaPliku[100];
- char *FIFO = "../potok";
- mkfifo(FIFO, 0666);
- while(1)
- {
- potok_fd = open(FIFO, O_WRONLY);
- printf("Plik do odczytu: ");
- scanf("%s", nazwaPliku);
- deskryptor = open(nazwaPliku, O_RDONLY);
- while ((licznik=read(deskryptor, bufor, 8)) > 0)
- {
- write(potok_fd, bufor, licznik);
- }
- close(potok_fd);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement