//
// Created by pengjian05 on 2020-07-29.
//
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iostream>
int main(int argc, char** argv) {
auto file_path = "base.bin";
std::fstream input2(file_path, std::ios::in | std::ios::binary);
// char data[72248];
char data[72248]{0};
input2.read((char*)data, 72248);
input2.close();
std::fstream input(file_path, std::ios::in | std::ios::binary);
// char data1[72248]; 内存申请之后要初始化?还没弄明白
char data1[72248]{0};
input.read((char*)data1, 72248);
input.close();
std::cout << "first:" << std::bitset<8>(data[800]) << std::endl;
std::cout << "second:" << std::bitset<8>(data1[800]) << std::endl;
std::cout << "first:" << std::bitset<8>(data[58007]) << std::endl;
std::cout << "second:" << std::bitset<8>(data1[58007]) << std::endl;
std::cout << "first:" << std::bitset<8>(data[58008]) << std::endl;
std::cout << "second:" << std::bitset<8>(data1[58008]) << std::endl;
std::cout << "first:" << std::bitset<8>(data[72176]) << std::endl;
std::cout << "second:" << std::bitset<8>(data1[72176]) << std::endl;
for (int i = 0; i < 72248; ++i) {
if (data[i] != data1[i]) {
std::cout << "error:" << i << ", first:" << std::bitset<8>(data[i])
<< ", second:" << std::bitset<8>(data1[i]) << std::endl;
}
}
std::cout << "here" << std::endl;
return 0;
}
【cpp】记录一次踩坑
最新推荐文章于 2024-07-12 10:49:34 发布