Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 5th, 2020 140 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <unistd.h>
  5. #include <fcntl.h>
  6.  
  7.  
  8. int main(int argc, char** argv)
  9. {
  10.     if(argc != 2)
  11.     {
  12.         fprintf(stderr, "Usage ./main file_path");
  13.     }
  14.    
  15.     const int to_sort = open(argv[1], O_RDONLY);
  16.     dup2(to_sort, 0);
  17.  
  18.     close(to_sort);
  19.  
  20.     FILE* out = popen("sort", "r");
  21.  
  22.     char buff[200];
  23.     int readed = 0;
  24.     while((readed = fread(buff, sizeof(char), 200, out)) > 0 )
  25.     {
  26.         write(STDOUT_FILENO, buff, readed);
  27.     }
  28.     pclose(out);
  29.  
  30.     close(to_sort);
  31.     return 0;
  32. }
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