文件操作总结

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);

原文地址:https://www.cnblogs.com/dj0325/p/9110725.html