SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include <fcntl.h>
  4. #include <sys/types.h>
  5. #include <sys/stat.h>
  6.  
  7.  
  8. int main(){
  9.  
  10. int potok_fd;
  11. int deskryptor;
  12. int licznik;   //ile bajtow          
  13. char bufor[8];        
  14.                                
  15. char nazwaPliku[100];    
  16. char *FIFO = "../potok";
  17.  
  18. mkfifo(FIFO, 0666);
  19. while(1)
  20. {
  21. potok_fd = open(FIFO, O_WRONLY);
  22.                                
  23. printf("Plik do odczytu: ");
  24. scanf("%s", nazwaPliku);
  25. deskryptor = open(nazwaPliku, O_RDONLY);
  26.                                    
  27.     while ((licznik=read(deskryptor, bufor, 8)) > 0)
  28.     {
  29.             write(potok_fd, bufor, licznik);
  30.         }
  31.                                
  32.     close(potok_fd);
  33.  
  34. }
  35.     return 0;
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top