daily pastebin goal
19%
SHARE
TWEET

read().c

a guest Apr 3rd, 2017 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <unistd.h>
  3.  
  4. int main()
  5. {
  6.     char *buf = NULL;
  7.     int len = 10;
  8.     len = read(STDIN_FILENO, buf, 40);
  9.     if (len > 0) {
  10.         printf("%d", len);
  11.         printf("\ngot %d bytes", len);
  12.         return 0;
  13.     }
  14.     else if (len <= 0)
  15.     {
  16.         printf("%d", len);
  17.         printf("\nFalse or got EOF");
  18.     }
  19.     return 0;
  20. }
RAW Paste Data
Top