포럼 회원으로 등록하신분만 다운로드가 가능합니다. 최대 업로드 가능한 용량은 1GB 입니다.
// normal linux
static void hexdump(uint8_t *_data, size_t size) {
uint8_t *data = (uint8_t *)_data;
size_t offset = 0;
size_t i = 0;
while (offset < size) {
printf("0x%04x ", offset);
size_t n = size - offset;
if (n > 16) {
n = 16;
}
for (i = 0; i < 16; ++i) {
if (i == 8) {
printf(" ");
}
if (offset + i < size) {
printf("%02x ", data[offset + i]);
} else {
printf(" ");
}
}
printf(" ");
for (i = 0; i < n; ++i) {
if (isprint(data[offset + i])) {
printf("%c", data[offset + i]);
} else {
printf(".");
}
}
printf("\n");
offset += 16;
}
}
Android의 경우는 printf대신 ALOGI 혹은 ALOGV, ALOGE등을 사용하시면 됩니다.