Lua小程序 十六进制字符串和二进制数据间的转换的认识.docVIP

  • 12
  • 0
  • 约8.16千字
  • 约 5页
  • 2017-03-28 发布于湖北
  • 举报

Lua小程序 十六进制字符串和二进制数据间的转换的认识.doc

Lua小程序 十六进制字符串和二进制数据间的转换 从十六进制字符串转为二进制数: 1 #! /usr/local/bin/lua 2 3 4 --Note: Input hex string files content must be 5 --a upper case hex string 6 7 --Check the arguments 8 if #arg ~= 2 then 9 print(Usage:hexstr2bytes.lua Input Hex String File Output Bytes File\n); 10 os.exit(); 11 end 12 13 --Open input hex string file 14 local hexstrfile = io.open(arg[1], rb); 15 if nil == hexstrfile then 16 print(Can not open input file!\n); 17 os.exit(); 18 end 19 20 --Read from the hex string file 21 local hexstr = hexstrfile:read(*a); 22 if nil == hexstr then 23 print

文档评论(0)

1亿VIP精品文档

相关文档