This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: 64 bit I/O functions (such as stat/ftruncate)
- From: Brian Dessent <brian at dessent dot net>
- To: John Gateley <gateley at jriver dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 06 Dec 2007 12:15:45 -0800
- Subject: Re: 64 bit I/O functions (such as stat/ftruncate)
- References: <20071206135116.4142b02d.gateley@jriver.com>
- Reply-to: gcc-help at gcc dot gnu dot org
John Gateley wrote:
> I'm looking for 64 bit I/O functions, such as ftruncate or
> stat/fstat/lstat. Some functions exist in 64 bit versions
> (such as lseek64), but for others I couldn't find anything.
> This is using g++ on linux.
Normally you don't call the 64 bit versions explicitly, you just add
-D_FILE_OFFSET_BITS=64 to CPPFLAGS and you get the large-file aware
version of all interfaces without the 64 suffix. If you really want to
call them by name then you instead define _LARGEFILE64_SOURCE and you
get the interfaces with the 64 suffix, but that was only added as a
crutch for the transition period where some programs weren't LFS aware.
Those days should hopefully be in the past, so don't uglify your code
unnecessarily.
> Sorry if this isn't the appropriate venue for this question.
> I couldn't find a better one. Please direct me on if it isn't.
These functions are provided by the libc, which is not a part of gcc, so
it's technically off topic here. See the glibc manual for details:
<http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html>.
Brian