Advertisement
rplantiko

bin2hex

Jan 23rd, 2014
495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.46 KB | None | 0 0
  1. #- Bin2Hex.pl
  2. #- Copyright (c) 1995 by Dr. Herong Yang, http://www.herongyang.com/
  3. # Slightly adapted for generating ABAP XSTRING testdata from a raw file
  4. #
  5.    $in = "test.xlsx";  
  6.    $byteCount = 0;
  7.    open(IN, "< $in");
  8.    binmode(IN);  
  9.    while (read(IN,$b,32)) {
  10.       $n = length($b);
  11.       $byteCount += $n;
  12.       $s = 2*$n;
  13.       print "`".uc(unpack("H$s", $b))."`,\n";
  14.    }
  15.    close(IN);
  16.    print "Number of bytes converted = $byteCount\n";
  17.    exit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement