如何使用 C fread 读取大于 2GB 的文件? | 珊瑚贝

How to read a file larger than 2GB using C fread?

本问题已经有最佳答案,请猛点这里访问。


Possible Duplicate:
2GB limit on file size when using fwrite in C?

我意识到对于我的 C 编译器,fread 函数只能正确读取小于 2GB (2147483648) 的文件。我想知道我们是否可以读取 >2GB 的文件。谢谢

  • 可以将 open() 和 read() 与 int 文件描述符一起使用,而不是 fopen() 和 fread() 与 FILE 指针一起使用。 FILE 结构很可能是您的 32 位限制的根源,并且无论文件有多大,重复的 read() 调用都会起作用。


您需要使用大文件支持进行编译。或者,在某些平台上,您可以使用 fopen64.


来源:https://www.codenong.com/12268327/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_10123.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?