基础知识:
numpy.tofile 存储的就是原始二进制数据,可直接进行二进制数据解析
numpy.float16 2字节
numpy.float32 4字节
C++ float 4字节
C++ double 8字节
类型 | 类型 | |
int8_t |
char |
|
uint8_t | unsigned char | |
读取二进制文件,存入数组
int read(std::string &filepath, std::vector<uint8_t> &char_list)
{
FILE* file = fopen(filepath.c_str(), "rb");
if (file == NULL)
{
std::cout << "read bin file failed: " <&