找回密码
 加入
搜索
查看: 2022|回复: 2

[系统综合] 如何写把文件输出为16进制的数据

[复制链接]
发表于 2011-5-27 23:38:50 | 显示全部楼层 |阅读模式
本帖最后由 江郎才尽 于 2011-5-27 23:49 编辑

如何写把文件输出为16进制的数据


$file = FileOpen("test.png", 0)
$file1 = FileOpen("test.txt", 16)

While 1
    $chars = FileRead($file,1)
If @error  = -1 Then
    ExitLoop
Else
        FileWrite($file1, $chars)
EndIf       
Wend

FileClose($file1)
FileClose($file)

Exit


上面的这个代码不行
发表于 2011-5-28 09:56:31 | 显示全部楼层
本帖最后由 suiyefeng 于 2011-5-28 11:04 编辑

提供个思路...
$file = FileOpen("test.png", 16)
$file1 = FileOpen("test.txt", 2)
Dim $m = 0
While 1
    $chars = (FileRead($file,4))
        If @error  = -1 Then
                ExitLoop
        Else
                $chars=String($chars)
                $chars=StringMid($chars,3)
                $m = $m + 1
                FileWrite($file1,$chars)
                If $m = 4 Then 
                        FileWrite($file1,@CRLF)
                        $m=0
                EndIf
        EndIf
Wend

FileClose($file1)
FileClose($file)
发表于 2011-6-9 00:37:20 | 显示全部楼层
有点困难。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-21 05:38 , Processed in 0.101077 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表