hex2bin和bin2hex互转的小程序源代码

bin2hex的程序比较简单,利用fprintf的格式化输出就行了,code见下图
在这里插入图片描述
在这里插入图片描述

hex2bin的源代码稍微复杂一些,因为写bin文件只能通过fwrite操作,程序如下图
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
hex2bin v2.2, Copyrhex2bin v2.2, Copyright (C) 2015 Jacques Pelletier & contributorsight (C) 2015 Jacques Pelletier & contributors usage: hex2bin [OPTIONS] filename Options: -a Address Alignment Word (hex2bin only) -b Batch mode: exits if specified file doesn't exist -c Enable record checksum verification -C [Poly][Init][RefIn][RefOut][XorOut] CRC parameters -e [ext] Output filename extension (without the dot) -E [0|1] Endian for checksum/CRC, 0: little, 1: big -f [address] Address of check result to write -F [address] [value] Address and value to force -k [0-4] Select check method (checksum or CRC) and size -d display list of check methods/value size -l [length] Maximal Length (Starting address + Length -1 is Max Address) File will be filled with Pattern until Max Address is reached -m [size] Minimum Block Size File Size Dimension will be a multiple of Minimum block size File will be filled with Pattern Length must be a power of 2 in hexadecimal [see -l option] Attention this option is STRONGER than Maximal Length -p [value] Pad-byte value in hex (default: ff) -r [start] [end] Range to compute checksum over (default is min and max addresses) -s [address] Starting address in hex for binary file (default: 0) ex.: if the first record is :nn010000ddddd... the data supposed to be stored at 0100 will start at 0000 in the binary file. Specifying this starting address will put pad bytes in the binary file so that the data supposed to be stored at 0100 will start at the same address in the binary file. -v Verbose messages for debugging purposes -w Swap wordwise (low <-> high)

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值