Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void DumpHex(const char *p, int size)
- {
- int left = size;
- while(left > 0)
- {
- int i;
- for(i = 0; i < 16; i++)
- {
- printf("%2.2X ", *p++);
- left--;
- if(left <= 0)
- break;
- }
- printf("\n");
- }
- }
- int main()
- {
- char testdat[] = "\x42\x23\x09\x00\x63\x12\x22";
- char testdat2[] = "Something longer than 16 bytes to see wrapping. Blah Blah Blah";
- printf("testdat:\n");
- DumpHex(testdat, sizeof(testdat)-1);
- printf("testdat2:\n");
- DumpHex(testdat2, sizeof(testdat2)-1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement