Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 16th, 2013  |  syntax: None  |  size: 0.33 KB  |  views: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <stdlib.h>
  2. #include <errno.h>
  3. #include <stdio.h>
  4.  
  5. static char buf[1];
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9.         int fd;
  10.         int ret;
  11.  
  12.         if (argc < 2)
  13.                 exit(1);
  14.  
  15.         fd = open(argv[1], 0);
  16.         if (fd < 0)
  17.                 exit(1);
  18.  
  19.         ret = read(fd, (size_t)-1, buf);
  20.         printf("ret: %d %d\n", ret, errno);
  21.  
  22.         close(fd);
  23.        
  24.         return 0;
  25. }
clone this paste RAW Paste Data