由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Linux版 - perl pack question
相关主题
How to convert dec to ip address using perla script for firefox using memory
C 89的话,怎么方便的把一个文件的行重排有人用chromium能看成flash嘛?
请问一个关于linux下连接UDP服务器的问题how to download an old kernel source code using ubuntu
how to convert data in ARM format to x86 format?debian下的unrar-free不能用了...
发狠了问题:关于python和web
SAMBA 打印机驱动自动安装 miniHOWTOMono Wins Product of the Year Award
nxserver 不能安装perl能不能一次把一个str中的a替换成x,b替换成y?
菜鸟求教怎么卸载amsnany bash command option similar as perl -c to check the syn
相关话题的讨论汇总
话题: b8话题: newword话题: pack话题: unpack话题: 0x00001388
进入Linux版参与讨论
1 (共1页)
w*s
发帖数: 7227
1
i read 4 bytes from a file,
say it's 88130000 in the hex format,
now i want to pack it to 0x00001388 which is 5000 dex.
so basically how to convert 0x88130000 into 5000 (0x00001388).
my code is like this, way to complicated.
$bytes = read($fh, $buf, 4);
$word = unpack 'H*', $buf;
print $word."\n";

($d2,$d3,$d0,$d1) = unpack("b8 b8 b8 b8", $word);
$newWord = pack("b8 b8 b8 b8", $d0,$d1,$d2,$d3);
print $newWord."\n";
print hex($newWord)."\n";
any suggestions ?
w****w
发帖数: 521
2
use v to unpack to little endian.
1 (共1页)
进入Linux版参与讨论
相关主题
any bash command option similar as perl -c to check the syn发狠了
Parrot VM 跑 perl python PHP Ruby 啥意思?SAMBA 打印机驱动自动安装 miniHOWTO
这个perl的简单小程序为什么不work?nxserver 不能安装
网页如何马上更新呢菜鸟求教怎么卸载amsn
How to convert dec to ip address using perla script for firefox using memory
C 89的话,怎么方便的把一个文件的行重排有人用chromium能看成flash嘛?
请问一个关于linux下连接UDP服务器的问题how to download an old kernel source code using ubuntu
how to convert data in ARM format to x86 format?debian下的unrar-free不能用了...
相关话题的讨论汇总
话题: b8话题: newword话题: pack话题: unpack话题: 0x00001388