Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #ifndef _GNU_SOURCE
  2. #define _GNU_SOURCE
  3. #endif
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <unistd.h>
  9. #include <fcntl.h>
  10. #include <sys/wait.h>
  11. #include <errno.h>
  12.  
  13. const int PIPE_SIZE = 65536;
  14.  
  15. int main() {
  16. char buf[PIPE_SIZE - 1];
  17.  
  18. while (1) {
  19. memset(buf, 0, PIPE_SIZE);
  20.  
  21. size_t received_size = read(STDIN_FILENO, buf, sizeof buf);
  22. if ((int)received_size == 0) {
  23. break;
  24. }
  25.  
  26. printf(">>>>>\n");
  27. printf("%s\n", buf);
  28. }
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement