c++读取raw文件保存到vector中
template <typename T>
void readT_raw(char* file_path,std::vector<T>& buffer1){
char* filePath = std::move(file_path);
std::ifstream file(filePath,std::ios::binary);
file.seekg(0,std::ios::end);
std::streampos fileSize = file.tellg();
file.seekg(0,std::ios::beg);
char* buffer = new char[fileSize];
file.read(buffer,fileSize);
file.close();
T* data = (T*)(buffer);
int numPixels = fileSize/sizeof(T);
for(int i =0;i<numPixels;i++){
buffer1.push_back(data[i]);
}
}
生命依靠吸收负熵,避免了趋向平衡的衰退

浙公网安备 33010602011771号