in reply to Re^3: Hex Question(s)
in thread Hex Question(s)
The resulting hex stuff should look like this: \x59\x7c\x02\x00 and if I replace $finalHex above with "\x59\x7c\x02\x00" then my code works fine (but that's not an acceptable solution because the initial integer isn't always going to be 1501299200).$theInt = 1501299200; $theHex = sprintf("%lx", $theInt); $hexPairs = split(/(\w{1,2})/, $theHex); while $val (@hexPairs) { if (!$thisPair eq "" ) { $finalHex .= "\x".$thisPair; } } $bytes .= pack("C/a*", $finalHex);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Hex Question(s)
by Corion (Patriarch) on Mar 27, 2008 at 17:16 UTC |