🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #4663

Re: Wanted: Filelength() function

#4663
From: Jean-Michel Forgeas
Date: Wed, 01 Aug 1990 13:44
21 lines
1121 bytes
In article <2671@mindlink.UUCP> a665@mindlink.UUCP (Anthon Pang) writes:
>I don't think there's a function that returns the filelength of a file, with
>AmigaDOS.  But I need an equivalent...how do you determine the length of a file
>given only the file handle (eg from an Open)?  There must be a way to find the
>[...]
>Thanks.

Alexander Livshits showed me this little trick, here it is:

int filelength( fh )
{
    Seek( fh, 0, OFFSET_END );
    return( Seek( fh, 0, OFFSET_BEGINNING ) );
}

--
                                     \___/
Jean-Michel Forgeas                   \-/
cbmvax!cbmehq!cbmfra!swinjm!forgeas    |    The Software Winery
                                      -^-
                           And, where is the universe ?
Technical Details
Message-ID: <forgeas.1537@swinjm.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!rutgers!cbmvax!cbmehq!cbmfra!swinjm!forgeas
References: <2671@mindlink.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!rutgers!cbmvax!cbmehq!cbmfra!swinjm!forgeas
From: forgeas@swinjm.UUCP (Jean-Michel Forgeas)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Wanted: Filelength() function
Message-ID: <forgeas.1537@swinjm.UUCP>
Date: 1 Aug 90 13:44:56 GMT
References: <2671@mindlink.UUCP>
Lines: 22