基本通信协议格式打印(用来调试)

#include "stdafx.h"
#include <stdio.h>
#include <string.h>
#include <math.h>
#include<stdlib.h>
#include <dos.h>
#include <conio.h>

typedef unsigned char u8;

void  print_hex(u8*buf, int length)
{
    for (int i = 0; i < length; i++)
    {
        printf(" 0x%x",(u8)buf[i]);

    }
    printf("\n");
}

static u8 buf[] =
{
   0xff,0xff,0xff,0xff,0x01,0x02,0x03,0x04,0x05
};



int main()
{
    print_hex(buf,10);
    while (1);

    return 0;
}

posted @ 2020-05-04 19:38  卷哭你  阅读(126)  评论(0编辑  收藏  举报