Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <stdlib.h>
  4. #include <unistd.h>
  5. #include <stdio.h>
  6. #include <sys/stat.h>
  7. #include <fcntl.h>
  8. int main(int argc, char *argv[]) {
  9.  
  10. mkfifo("truba.pipe",S_IRUSR |S_IWUSR);
  11. char buf[30];
  12. int az;
  13. az = open("truba.pipe", O_RDONLY);
  14. system("echo >truba.pipe "
  15. "Talking to yourself is educational!");
  16. read(az, buf, 30);
  17.  
  18. printf("peredalos");
  19. printf(buf);
  20. return EXIT_SUCCESS;
  21.  
  22. }
  23.  
  24.  
  25.  
  26.  
  27. #include <cstdlib>
  28. #include <iostream>
  29. #include <stdlib.h>
  30. #include <unistd.h>
  31. #include <stdio.h>
  32.  
  33. int main(int argc, char *argv[]) {
  34. int rw[2];
  35. int fr;
  36. int dat;
  37. char dt[4];
  38. pipe(rw);
  39. write(rw[1],"23!",3);
  40. close(rw[1]);
  41.  
  42. fr=fork();
  43.  
  44. if (fr ==0)
  45. {
  46. printf("Ya sinok! ");
  47. read(rw[0],dt,3);
  48. printf("%s",dt);
  49. }
  50.  
  51. return 0;
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement