Off-the-Shelf C++ Hex Dump Code

前端 未结 7 1937
走了就别回头了
走了就别回头了 2020-12-05 15:05

I work a lot with network and serial communications software, so it is often necessary for me to have code to display or log hex dumps of data packets.

Every time I

7条回答
  •  长情又很酷
    2020-12-05 15:30

    I often use this little snippet I've written long time ago. It's short and easy to add anywhere when debugging etc...

    #include 
    #include 
    
    void hexdump(void *ptr, int buflen) {
      unsigned char *buf = (unsigned char*)ptr;
      int i, j;
      for (i=0; i

提交回复
热议问题