Path: utzoo!mnetor!uunet!husc6!ukma!gatech!mcnc!thorin!unc!steele From: steele@unc.cs.unc.edu (Oliver Steele) Newsgroups: comp.sys.mac Subject: Re: how to get file size (in bytes) ??? Message-ID: <2013@thorin.cs.unc.edu> Date: 28 Mar 88 14:47:28 GMT References: <3774@adobe.COM> Sender: news@thorin.cs.unc.edu Reply-To: steele@unc.UUCP (Oliver Steele) Followup-To: comp.sys.mac.programmer Organization: University Of North Carolina, Chapel Hill Lines: 23 Keywords: Lightspeed C [Mail bounced. Follow-ups directed to comp.sys.mac.programmer.] greid@.UUCP (Glenn Reid) writes: >What is the appropriate incantation to determine the size of a file? >I have been digging through the File Manager documentation and such, >and all I can come up with is something like this, which doesn't seem >to work: > > FSOpen ( filename, refnum ); > GetEOF ( refnum, &longsize ); try FSOpen( filename, volnum, &refnum); where volnum can be 0 if the file's in the application directory or in the System File, or copied from the SFReply record if you're using the Standard File Package. Make sure that filename is a Pascal string, like "\pfoo" instead of "foo", and if you want to be safe, check for a non-zero return value from FSOpen() to see if you got an error. ---------------------------------------------------------------------------- Oliver Steele ...!uunet!mcnc!unc!steele steele@cs.unc.edu "I worry about anyone under eighteen who isn't a cynic -- and anyone over eighteen who is." -- Spider Robinson