Article View: comp.sys.amiga.tech
Article #4665Re: Wanted: Filelength() function
From: Peter da Silva
Date: Thu, 02 Aug 1990 10:38
Date: Thu, 02 Aug 1990 10:38
18 lines
1007 bytes
1007 bytes
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. `-_-'
<peter@sugar.hackercorp.com>.
Technical Details
Message-ID:
<6126@sugar.hackercorp.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!texbell!sugar!peterReferences:
<2671@mindlink.UUCP> <forgeas.1537@swinjm.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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> <forgeas.1537@swinjm.UUCP> Reply-To: peter@sugar.hackercorp.com (Peter da Silva) Organization: Sugar Land Unix - Houston Lines: 18