文件操作总结

1.读取文件

FILE *file = fopen(file_path,"rb");

2.获取文件大小

fseeko(file,0,SEEK_END);

uint64_t file_size = ftello(file);

fseeko(file,0,SEEK_SET);

3.读取文件

size_t fread ( void *buffer, size_t size, size_t count, FILE *stream) ;

例如读取整个文件

char * buf=new char[file_size];

fread(buf,file_size,1,file);

posted @ 2018-05-30 14:41  蓝天飞翔的白云  阅读(107)  评论(0编辑  收藏  举报