首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

计算资料crc32(精简版)

2012-09-29 
计算文件crc32(精简版)#include boost/iostreams/device/mapped_file.hpp //文件内存映射#include boos

计算文件crc32(精简版)

#include <boost/iostreams/device/mapped_file.hpp> //文件内存映射

#include <boost/crc.hpp> //冗余校验

unsigned long crc32file(const char* szFileName)
{
 boost::iostreams::mapped_file _mapfile(szFileName);
 if (!_mapfile.is_open())
  return 0;

 boost::crc_32_type _crc32type;
 _crc32type.process_bytes(_mapfile.data(),_mapfile.size());
 _mapfile.close();
 return _crc32type.checksum();
}

 

热点排行