Advertisement
piffy

pipe_con_nome

Aug 31st, 2014
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. /* Basato sul programma originale di <mij@bitchx.it>
  2.  * disponibile qui http://mij.oltrelinux.com/devel/unixprg/
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <fcntl.h>
  8. #include <sys/types.h>
  9. #include <sys/uio.h>
  10. #include <unistd.h>
  11.  
  12. #define MAX_BUF 20
  13.  
  14. int main(int argc, char *argv[]) {
  15.     int pipe;
  16.     char buf[MAX_BUF];
  17.    
  18.     pipe = open("pippo_pipe", O_RDONLY);
  19.     if (pipe < 0) { perror("ERR: Apertura pipe"); exit(1);}
  20.    
  21.     read(pipe, buf, MAX_BUF);
  22.     printf("Ricevuto: %s\n", buf);  
  23.     close(pipe);
  24.    
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement