Advertisement
diegoaguilar

proga

Mar 2nd, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <fcntl.h>
  5. #include <sys/types.h>
  6. #include <sys/stat.h>
  7. #include <unistd.h>
  8. #include <string.h>
  9.  
  10. int main(){
  11.     int fd;
  12.     mode_t modo=0666;
  13.     int i;
  14.    
  15.     mkfifo("numeros",modo);
  16.     fd=open("numeros",O_WRONLY);
  17.     for(i=0;i<100;i++){
  18.         if(i%2==0){
  19.             write(fd,&i,sizeof(i));
  20.         }
  21.     }
  22.     printf("se han mandado 50 numeros pares a la fifo\n");
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement