在文件>上没有-D_FILE_OFFSET_BITS = 64的off_t中2GB [英] off_t without -D_FILE_OFFSET_BITS=64 on a file > 2GB
问题描述
1-我想知道,如果我尝试读取大小大于2GB
的文件,而没有使用off_t
并使用off_t
选项和off_t
使用第二个函数来编译程序,那将会是什么问题呢? a href ="https://stackoverflow.com/questions/8236/how-do-you-determine-the-size-of-a-file-in-c/8384#8384">此页面?会出现段错误吗?
1- I'm wondering, what would be the problem if I try to read a file greater than 2GB
in size without compiling my program with the option -D_FILE_OFFSET_BITS=64
using off_t
and using the second function on this page? would it segfault?
2-我打算使用有什么问题吗?
推荐答案
-
stat()将失败,并设置errno 在这种情况下增加到ELOWFLOW.这是 linux手册页怎么说
stat() will fail, and errno set to EOVERFLOW in that case. Here's what the linux man page says
EOVERFLOW stat()) path refers to a file whose size cannot be
represented in the type off_t. This can occur when an application
已编译 在没有-D_FILE_OFFSET_BITS = 64的32位平台上调用stat() 文件大小超过(2<< 31)-1位.
compiled on a 32-bit platform without -D_FILE_OFFSET_BITS=64 calls stat() on a file whose size exceeds (2<<31)-1 bits.
这篇关于在文件>上没有-D_FILE_OFFSET_BITS = 64的off_t中2GB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!