void read_firm(){
char path[] = R"(C:\Users\yanzhichen\Desktop\file_share\hikvision_firmware\IPC_E2_EN_STD_5.4.4_161105.dav)";
ifstream fin;
fin.open(path, ios::binary);
if(!fin){
cout<<"open error!"<<endl;
return;
}
fin.seekg(0, ios_base::end);
long long firm_len = fin.tellg();
printf("size of firm: %lld\n", firm_len);
fin.seekg(0, ios_base::beg);
auto* pSrcBuf = new char[firm_len];
fin.read((char*)pSrcBuf, sizeof(char) * firm_len);
for(int i = 0; i < firm_len;){
if (i % 16 != 0) printf(" ");
printf("%02X", (unsigned char)pSrcBuf[i]);
i++;
if (i % 16 == 0) printf("\n");
}
delete [] pSrcBuf;
}
效果图:
|