Friday, July 4, 2014

如何快速打印出記憶體內容 for C programming


       
char *buf;
...
for (i=0; i<buf_size; i++)
    printf("%02x ", buf[i] & 0xff);
 

or

       
unsigned char *buf;
...
for (i=0; i<buf_size; i++)
    printf("%02x ", buf [i]);
 

No comments:

Post a Comment