Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <inttypes.h>
  5.  
  6. int main(int argc, char* argv[]) {
  7. uint64_t result = 0;
  8. char * str = argv[1];
  9. if (argc > 1) {
  10. while (*str) {
  11. char *end;
  12. uint64_t b = 1;
  13. long val = strtoll(str, &end, 8);
  14. if (*str != *end) {
  15. str = end;
  16. val -= 1;
  17. result |= b << val;
  18. }
  19. if (*str || str == end) {
  20. str +=1;
  21. }
  22. }
  23. }
  24. printf("%" PRIx64 "\n", result);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement