Advertisement
Guest User

Untitled

a guest
Apr 14th, 2016
180
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include <fcntl.h>
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7. char l = 1;
  8. unsigned char buf;
  9. int fd;
  10. fd = open(argv[1],0,S_IRUSR);
  11. while(read(fd,&buf,1)) {
  12. if(buf == 0 && l == 1) {
  13. printf(" \n");
  14. l = 0;
  15. }
  16. else if(buf) {
  17. printf("\\x%02x",buf);
  18. l = 1;
  19. }
  20. }
  21.  
  22. close(fd);
  23. }
Advertisement
RAW Paste Data Copied
Advertisement