🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Wanted: Filelength() function

#4677
From: Brian Sullivan
Date: Thu, 02 Aug 1990 00:49
23 lines
1325 bytes
> 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
> associated file lock, as one is created when the file is opened (shared /
> exclusive)...right?  Then you can Examine the FileInfoBlock and get the file's
> length from the fibSize field.
> 
>     ie    size_t  filelength(int handle)
> 
> I want a function that doesn't require knowing the filename...or do I need 2.0?
> 
> Thanks.

   I needed such a function once before, when porting the UNIX compress
utility to the Amiga.   I you are using Lattice C you can you the lseek(2)
library call like this:

        off_t  sz;
        ...
        sz = lseek( fd, 0, SEEK_END);


        
Technical Details
Message-ID: <9890003@hpcljms.HP.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!sdd.hp.com!hplabs!hpfcso!hpfcmdd!hpbbrd!hpbbn!hpcc01!hpcuhb!hpcllla!hpclisp!hpcljms!brians
References: <2671@mindlink.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!sdd.hp.com!hplabs!hpfcso!hpfcmdd!hpbbrd!hpbbn!hpcc01!hpcuhb!hpcllla!hpclisp!hpcljms!brians
From: brians@hpcljms.HP.COM (Brian Sullivan)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Wanted: Filelength() function
Message-ID: <9890003@hpcljms.HP.COM>
Date: 2 Aug 90 00:49:27 GMT
References: <2671@mindlink.UUCP>
Organization: Hewlett-Packard Calif. Language Lab
Lines: 23