C   19

cat5

Guest on 1st June 2022 01:25:18 AM

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <sys/types.h>
  4. #include <sys/uio.h>
  5. #include <unistd.h>
  6.  
  7. #define BUFSIZE 8192
  8. char buf[BUFSIZE];
  9.  
  10. int
  11. main()
  12. {
  13.   size_t count = 5;
  14.  
  15.   count = read(0, buf, count);
  16.   if (count == -1)  {
  17.     perror("read failed");
  18.     exit(1);
  19.   }
  20.   count = write(1, buf, count);
  21.   if (count == -1) {
  22.     perror("write failed");
  23.     exit(1);
  24.   }
  25.   fprintf(stderr, "\n%zd bytes moved\n", count);
  26. }

Raw Paste


Login or Register to edit or fork this paste. It's free.