Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ames!decwrl!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 > 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);