c 十六进制打印
来源:互联网 发布:java工程师招聘 编辑:程序博客网 时间:2024/06/18 13:55
void dump_hex( const unsigned char *buf, int len)
{
int i;
int nlocal;
const unsigned char *pc;
char *out;
const unsigned char *start;
char c;
char line[100];
start = buf;
while (len > 0)
{
sprintf(line, "%08x: ", buf - start);
out = line + 10;
for (i = 0, pc = buf, nlocal = len; i < 16; i++, pc++)
{
if (nlocal > 0)
{
c = *pc;
*out++ = NIBBLE((c >> 4) & 0xF);
*out++ = NIBBLE(c & 0xF);
nlocal--;
}
else
{
*out++ = ' ';
*out++ = ' ';
} /* end else */
*out++ = ' ';
} /* end for */
*out++ = '-';
*out++ = ' ';
for (i = 0, pc = buf, nlocal = len;
(i < 16) && (nlocal > 0);
i++, pc++, nlocal--)
{
c = *pc;
if ((c < ' ') || (c >= 126))
{
c = '.';
}
*out++ = c;
} /* end for */
*out++ = 0;
llog(L_NOTICE,"%s", line);
buf += 16;
len -= 16;
} /* end while */
} /* end dump */
{
int i;
int nlocal;
const unsigned char *pc;
char *out;
const unsigned char *start;
char c;
char line[100];
start = buf;
while (len > 0)
{
sprintf(line, "%08x: ", buf - start);
out = line + 10;
for (i = 0, pc = buf, nlocal = len; i < 16; i++, pc++)
{
if (nlocal > 0)
{
c = *pc;
*out++ = NIBBLE((c >> 4) & 0xF);
*out++ = NIBBLE(c & 0xF);
nlocal--;
}
else
{
*out++ = ' ';
*out++ = ' ';
} /* end else */
*out++ = ' ';
} /* end for */
*out++ = '-';
*out++ = ' ';
for (i = 0, pc = buf, nlocal = len;
(i < 16) && (nlocal > 0);
i++, pc++, nlocal--)
{
c = *pc;
if ((c < ' ') || (c >= 126))
{
c = '.';
}
*out++ = c;
} /* end for */
*out++ = 0;
llog(L_NOTICE,"%s", line);
buf += 16;
len -= 16;
} /* end while */
} /* end dump */
阅读全文
0 0
- c 十六进制打印
- C语言printf 打印十六进制数字0x01
- 十六进制 字符打印
- printf打印十六进制
- 十进制数打印成十六进制
- 十进制打印 转换二进制 十六进制
- 十六进制转十进制 - C
- 十进制转十六进制 - C
- C--显示十六进制数字
- C++打印字符串十六进制值函数
- 以十六进制和字符串方式打印缓冲区
- gdb用十六进制打印变量值
- C 打印
- C语言读取十六进制数据
- 【学习】C#(1)输出十六进制
- 十六进制加法 C和C++
- 十六进制命令校验C代码
- c语言double十六进制输出
- 开始记录一些东西
- 【C#】WindowsAPICodePack-Shell使用教程
- 同一个电脑安装两个版本的JDK
- 微信接口开发,errcode 45047
- Tcl/Tk windows版下载与安装过程
- c 十六进制打印
- BZOJ1344 [Baltic2007]Connected Points连点
- Oracle 高水位说明和释放表空间,加快表的查询速度
- VB 中的BatchUpdate 使用
- HTML2Excel 将table2excel 将table转换为Excel 支持合并单元格,边框 -- HTML2OFFICE教程1
- eclipse中 将java项目转换为web项目
- Synctoy2.1通过计划任务备份文件到网络驱动器注销不生效问题
- maven web创建
- 2017 年 PHP 程序员未来路在何方