Xref: utzoo comp.sys.amiga:43408 comp.sys.amiga.tech:8094 Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!ncar!tank!eecae!cps3xx!usenet From: usenet@cps3xx.UUCP (Usenet file owner) Newsgroups: comp.sys.amiga,comp.sys.amiga.tech Subject: Re: Lattice 5.02 Keywords: stat + 5.04 Message-ID: <5321@cps3xx.UUCP> Date: 9 Nov 89 19:46:38 GMT References: <1989Nov8.173040.17138@cat.fulcrum.bt.co.uk> <127655@sun.Eng.Sun.COM> Reply-To: porkka@frith.UUCP (Joe Porkka) Organization: Michigan State University Lines: 28 In article <127655@sun.Eng.Sun.COM> cmcmanis@sun.UUCP (Chuck McManis) writes: ->Simon Raybould writes: ->>I am trying to find out the size of a file in lattice C V5.02. ->>I have found the command to get the modification time and various other ->>file attributes, but not the file size. -> ->This is UNIX history affecting the Amiga. Actually, there is no such ->subroutine. Instead, you simply look at the return value from lseek(). ->Try this : -> fd = open("some file name", O_RDONLY); -> /* seek to the end of the file */ -> size = lseek(fd, 0L, 2); This way can be slooow for big files, especially for floppies. There is a direct way through DOS to get this info. FileLock=Lock(filename); Examine(FileLock,&FileInfoBlock); size=FileInfoBlock.Length; /* I think, check the includes */ The definitions you need are in and Info about Lock and Examine is in "AmigaDOS Developers Manual". If you don't have this, I may be able to send the info to you tomorrow. Joe Porkka porkka@frith.egr.msu.edu