Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!texbell!sugar!peter From: peter@sugar.hackercorp.com (Peter da Silva) Newsgroups: comp.sys.amiga.tech Subject: Re: Wanted: Filelength() function Message-ID: <6126@sugar.hackercorp.com> Date: 2 Aug 90 10:38:40 GMT References: <2671@mindlink.UUCP> Reply-To: peter@sugar.hackercorp.com (Peter da Silva) Organization: Sugar Land Unix - Houston Lines: 18 Best save and restore the current position, as well. > int filelength( fh ) > { + int old_off; ! old_off = Seek( fh, 0, OFFSET_END ); ! return( Seek( fh, old_off, OFFSET_BEGINNING ) ); > } Might also want to make things "long" just in case someone compiles it under old Manx. Or to be really minimalist: #define filelength(fh) Seek(fh, Seek(fh, 0L, OFFSET_END), OFFSET_BEGINNING) (oddly, my old DOS manual defines both OFFSET_END and OFFSET_BEGINNING as 1) -- Peter da Silva. `-_-' .