Author: Robert Hyatt
Date: 21:20:56 11/17/98
Go up one level in this thread
On November 17, 1998 at 20:44:15, Dann Corbit wrote: >However, Bob's code is written in ANSI C. If he switches to a Win32 API, it >fails on all the platforms that *he* uses, since he develops exclusively on >UNIX. His question about seeking was about fseek(), which is (indeed) >prototyped according to the standard: > > #include <stdio.h> > int fseek(FILE *stream, long int offset, int whence); > >so it is not possible using strictly portable code to seek farther forward than >LONG_MAX nor farther backward than LONG_MIN in a single jump. So the only way >around the portability problem is to use a database, cut the seeks into smaller >chunks or use machines and/or compilers with long implemented as 64 bits. Actually, trying Eugene's trick of multiple fseek()'s where you seek in 2 gig chunks isn't safe... because the ansi standard doesn't require that the max filesize be larger than the "offset" field... It might work (it would fail miserably on linux because of the way data blocks are indexed from an inode and the way those calculations are done... most other unix systems would also have problems unless they have a native long that is > 32 bits... Fortunately there are now several of those, MIPS, HP, IBM, DEC, Cray, etc... Even Sun when they decide to release a 64 bit solaris... if they ever do...
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.