Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * HEX-dump любого объекта
- * @param obj - объект, который нужно вывести
- * @param count - количество байт для вывода
- */
- template <class Type>
- void dump(Type const &obj, int count = sizeof(Type)) {
- for (int i = 0; i < count; i++) {
- if (i % 8 == 0 && i != 0) std::cout << std::endl;
- else if (i % 4 == 0 && i != 0) std::cout << " ";
- std::cout << "0x" << std::setfill('0') << std::setw(2) << std::hex << (((char *) &obj)[i] & 0xFF) << " ";
- }
- std::cout << std::endl;
- }
Add Comment
Please, Sign In to add comment