Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Apr 1998 15:00:55 -0500
From:      Dan Nelson <dnelson@emsphone.com>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   how to fseek past 2GB?
Message-ID:  <19980429150055.A17639@emsphone.com>

next in thread | raw e-mail | index | archive | help

I recently noticed that there is no way to fseek() past the 2GB mark on
files opened with fopen().  The offset in the FILE struct is an fpos_t;
there's just no way to get at it.

fseek(), unfortunately, is cursed with a "long" file offset, so that
can't change.

fsetpos() _could_ seek past the 2GB mark, since a fpos_t is a long
long. Our current fsetpos implementation simply calls 
(fseek(iop, (long)*pos, SEEK_SET)), though.

What I did for my own use is create lfseek() and lftell() functions
that basically copy the fseek() and ftell() source, but replace "long"
with "fpos_t".  It works great.

If I were to submit these as a PR,  what would be the best way to do
it?  I'm leaning toward making fseek() and fsetpos() call lfseek(), to
eliminate redundant code.

Is there a "standard" function name for a fseek() function that takes
an off_t or fpos_t?

	-Dan Nelson
	dnelson@emsphone.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980429150055.A17639>