dest += sprintf(dest, "%02x ", (unsigned char)src++);

ここ

dest += sprintf(dest, "%02x ", (unsigned char)*src++);

だべ。