Advertisement
Guest User

read().c

a guest
Apr 3rd, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement