C/c++中有哪个函数可以写出超过2GB的大文件,该怎么解决

C/c++中有哪个函数可以写出超过2GB的大文件
如题

------解决方案--------------------
fopen, fsetpos, fwrite
编译时指定大文件支持即可。

The following example shows how an application using threads interfaces can test for support of and use a programming environment supporting 32-bit int, long, and pointer types and an off_t type using at least 64 bits:

if [ $(getconf _POSIX_V6_ILP32_OFFBIG) != "-1" ]
then
c99 $(getconf POSIX_V6_ILP32_OFFBIG_CFLAGS) -D_XOPEN_SOURCE=600 \
$(getconf POSIX_V6_ILP32_OFFBIG_LDFLAGS) foo.c -o foo \
$(getconf POSIX_V6_ILP32_OFFBIG_LIBS) -l pthread
else
echo ILP32_OFFBIG programming environment not supported
exit 1
fi


------解决方案--------------------
流(含内存流)均支持超过4G文件:size是__int64类型的。
不支持超过2G的原因是因为文件系统本身是32位的,当指针超出2G时,操作系统地址快表实际已发生回滚溢出了(负地址)。因此,要想超过2G的大文件,你首先得讲操作系统改成支持大文件系统的,或干脆升到64位。