找回密码
 加入
搜索
查看: 1291|回复: 1

请教如何读取非txt文件中指定位置的内容?

[复制链接]
发表于 2009-3-7 15:39:05 | 显示全部楼层 |阅读模式
文件用uedit32打开大概格式如下。


1,文件特定位置有字符串。
2,文件特定位置有数值(16进制)
3,文件中的字符串和数值间隔有规律。

问题:如何通过au3来读取特定位置的字符串和数值?
试了用StringMid无效。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2009-3-7 17:57:11 | 显示全部楼层

;*基本函数
;读取字节
Func Binary_Read($address)
        Return StringMid($file, $address * 2 + 3, 2)
EndFunc   ;==>Binary_Read

;替换字节
Func Binary_Replace($address, $val)
        $file = StringReplace($file, $address * 2 + 3, Hex($val, 2))
EndFunc   ;==>Binary_Replace

;读取文件
Func Binary_ReadFile($filename)
        Global $file = FileRead(FileOpen($filename, 16))
EndFunc   ;==>Binary_ReadFile

;写入文件
Func Binary_WriteFile($filename)
        Return FileWrite(FileOpen($filename, 18), Binary($file))
EndFunc   ;==>Binary_WriteFile


我还是用的StringMid...具体的参数检测都没有加入 Binary_Replace($address, $val)的替换参数是十进制的
因为是自己用的 需要的话...请自行修改

[ 本帖最后由 rolaka 于 2009-3-7 18:00 编辑 ]
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-23 07:29 , Processed in 0.072110 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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