#include <iostream>
#include <fstream>
#include <iomanip>
using std::cout;
using std::endl;
#define SIZE 64
int main()
{
std::ifstream ifs("d:\\data.bin", std::ios::in | std::ios::binary);
if (!ifs) {
cout << "Error open file" << endl;
return 1;
}
char arr[SIZE];
int i;
cout.setf(std::ios::uppercase);
while (!ifs.eof()) {
for (i = 0; i < SIZE && !ifs.eof(); i++)
ifs.get(arr[i]);
for (int j = 0; j < i - 1; j++)
cout << std::setw(3) << std::hex << (int)arr[j];
cout << endl;
}
ifs.close();
return 0;
}
/*
run:
2D 0 0 0 8 0 0 0 C 0 0 0 62 0 0 0 6B 3 0 0
*/