c hexdump
来源:互联网 发布:怎么查手机网络密码 编辑:程序博客网 时间:2024/05/18 15:30
记录下,有时要打日志用
#ifndef hexdump_h
#define hexdump_h
#include <SYS\TIMEB.H> //windows加入此头文件
#ifdef __cpluscplus
extern "C"
{
#endif
void hexDump (char *desc,void *addr,int len);
char* log_Time(void);
#ifdef __cplusplus
}
#endif
#endif /* hexdump_h */
#include <stdio.h>
#include "hexdump.h"
#include <sys/timeb.h>
#include <time.h>
char* log_Time(void)
{
struct tm *ptm;
struct timeb stTimeb;
static char szTime[19];
ftime(&stTimeb);
ptm = localtime(&stTimeb.time);
sprintf(szTime,"%02d-%02d %02d:%02d:%02d.%03d",
ptm->tm_mon+1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec, stTimeb.millitm);
szTime[18] =0;
return szTime;
}
#define SIZE 255
void hexDump (char *desc,void *addr,int len) {
int i;
unsignedchar buffLine[17];
unsignedchar *pc = (unsignedchar*)addr;
if (desc !=NULL){
printf ("%s %s:\n",log_Time(), desc);
}
for (i =0; i < len; i++) {
if ((i %16) ==0) {
if (i !=0)
printf (" %s\n", buffLine);
printf ("%04x ", i);
}
// Prints the HEXCODES that represent each chars.
printf ("%02x", pc[i]);
if ((i %16) ==7)printf (" ");
printf (" ");
if ((pc[i] <0x20) || (pc[i] >0x7e)){
buffLine[i % 16] ='.';
}
else{
buffLine[i % 16] = pc[i];
}
buffLine[(i % 16) +1] ='\0';//Clears the next array buffLine
}
while ((i %16) !=0) {
printf (" ");
i++;
}
printf (" %s\n", buffLine);
}
- c hexdump
- hexdump
- HexDump
- hexdump
- linux c之hexdump的实现
- hexdump-s 0 -n 52 -C实例--helloworld
- linux c中的hexdump实现,用于打印内存
- hexdump命令
- hexdump用法
- hexdump 命令
- hexdump命令
- perl hexdump
- hexdump命令
- hexdump命令
- hexdump.asm
- linux c hexdump之实现cat的16进制显示数据
- Making Sense of Hexdump (hexdump用法)
- hexdump使用简例
- 【Unity3D基础知识点】——射线
- 利用 Flask+Redis 维护 IP 代理池
- SSSP整合:Context initialization failed
- codeforces 670C Cinema
- strust2 jquery ajax
- c hexdump
- Linux CentOS下MySQL忘记root密码解决方法【转载】
- Javascript 数据类型转换方式
- dos环境下操作mysql
- Datepicker Popup 弹窗部分遮盖处理方式,以及响应式菜单默认收起设置
- linux shell 中数组的定义和for循环遍历
- CPU卡程序设计实例(五)单片机系统主频设置
- 【数据压缩】Huffman编解码
- Android 7.1 竖屏转横屏全过程实现-基于高通平台