linux环境下读写超过2G的大文件

linux环境下读写超过2G的大文件

分类: 工作笔记 1033人阅读 评论(0) 收藏 举报

linux默认环境下打开、读、写超过2G的文件会返回错误。

定义如下宏可以突破这个限制,对read/write和fread/fwrite同时有效。

注意它必须定义在所有头文件之前。

#define  _FILE_OFFSET_BITS 64

#include 
< stdio.h >
#include 
< stdlib.h >
#include 
< sys / types.h >
#include 
< sys / stat.h >
#include 
< fcntl.h >
#include 
< unistd.h >
 

你可能感兴趣的:(工作笔记)