Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

HAR1F May 21st, 2020 (edited) 710 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <sys/types.h>
  2. #include <fcntl.h>
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7.   int fd;
  8.   const size_t size = 13;
  9.   char str[size + 1] = {0};
  10.  
  11.   if ((fd = open("myfile", O_RDONLY)) < 0)
  12.   {
  13.     printf("Can\'t open file\n");
  14.     exit(-1);
  15.   }
  16.  
  17.   int offset = 0,
  18.       bytes_read;
  19.  
  20.   for (; (bytes_read = read(fd, str + offset, size - offset)) > 0;)
  21.   {
  22.     offset += bytes_read;
  23.   }
  24.  
  25.   printf("%s\n", str);
  26.  
  27.   if (close(fd) < 0)
  28.   {
  29.     printf("Can\'t close file\n");
  30.   }
  31.  
  32.   return 0;
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top