Date: Thu, 30 Apr 1998 22:29:14 -0500 From: Dan Nelson <dnelson@emsphone.com> To: Terry Lambert <tlambert@primenet.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: how to fseek past 2GB? Message-ID: <19980430222914.A20607@emsphone.com> In-Reply-To: <199804300753.AAA00308@usr05.primenet.com>; from "Terry Lambert" on Thu Apr 30 07:53:58 GMT 1998 References: <19980429150055.A17639@emsphone.com> <199804300753.AAA00308@usr05.primenet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Apr 30), Terry Lambert said: > > 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. > > Heh. > ... > fseek( fp, 1<<30, SEEK_SET); /* first 2G*/ > fseek( fp, 1<<30, SEEK_CUR); /* next 2G*/ > ... > > It'd be easy to wrap this. 8-). Actually, this is illegal according to the man page at http://www.opengroup.org/onlinepubs/7908799/xsh/stdio.h.html . fseek is only allowed to seek to file offsets that ftell could return: [EOVERFLOW] For fseek(), the resulting file offset would be a value which cannot be represented correctly in an object of type long. Should I code for this error case, or let fseek hopscotch into the >2GB area? Are there any programs that even know it's possible? -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?19980430222914.A20607>