是什么_LARGEFILE_SOURCE和_FILE_OFFSET_BITS = 64之间的区别? [英] What is the difference between _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64?

查看:1187
本文介绍了是什么_LARGEFILE_SOURCE和_FILE_OFFSET_BITS = 64之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知, -D_FILE_OFFSET_BITS = 64 引起 off_t 是64位。那么,是什么 -D_LARGEFILE_SOURCE 做到这一点还没有被 -D_FILE_OFFSET_BITS = 64 做了什么?什么这些定义做什么呢?

I understand that -D_FILE_OFFSET_BITS=64 causes off_t to be 64bits. So what does -D_LARGEFILE_SOURCE do that isn't already done by -D_FILE_OFFSET_BITS=64? What do these definitions do exactly?

推荐答案

glibc的<一个href=\"http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html#Feature-Test-Macros\">Feature测试宏文档状态:

The GLIBC Feature test macros documentation states:

_LARGEFILE_SOURCE 结果
  如果该宏定义了一些额外的功能,可它纠正所有previous标准一些缺点。具体地,功能fseeko和ftello可用。如果没有这些功能的ISO C接口(fseek的,FTELL)和低级别的POSIX接口(lseek的)之间的差异会导致问题。

_LARGEFILE_SOURCE
If this macro is defined some extra functions are available which rectify a few shortcomings in all previous standards. Specifically, the functions fseeko and ftello are available. Without these functions the difference between the ISO C interface (fseek, ftell) and the low-level POSIX interface (lseek) would lead to problems.

本宏介绍,作为大文件支持扩展(LFS)的一部分。

This macro was introduced as part of the Large File Support extension (LFS).

所以,宏观专门让 fseeko ftello 可用。 _FILE_OFFSET_BITS 设置本身并不能使这些功能。

So that macro specifically makes fseeko and ftello available. _FILE_OFFSET_BITS settings alone don't make these functions available.

(注意,如果你使用C,与GCC默认的GNU话,你可能不需要明确定义 _LARGEFILE_SOURCE 。怎么做,如果你使用 -std = C99 的实例。)

(Note that if you're using a GNU dialect of C, the default with GCC, you might not need to explicitly define _LARGEFILE_SOURCE. You do if you use -std=c99 for instance.)

这篇关于是什么_LARGEFILE_SOURCE和_FILE_OFFSET_BITS = 64之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆