标签:har fstream 文件 读取 pre data opera 内存 fine
std::fstream fin("fine.name",std::fstream::in|std::fstream::ate);
if(fin.good()) {
size_t file_size=fin.tellg();
fin.seekg(0,std::fstream::beg);
size_t read_per=100;
size_t read_sum=0;
std::vector<char> file_data_vec(read_per,0);
while(read_sum<file_size) {
size_t read_can=std::min(read_per,file_size-read_sum);
fin.read(file_data_vec.data(),read_can);
read_sum+=read_can;
//operation
}
fin.close();
}
标签:har fstream 文件 读取 pre data opera 内存 fine
原文地址:https://www.cnblogs.com/smallredness/p/10936303.html