scotty@l5comp.UUCP (Scott Turner) (05/28/87)
I've noticed in several programs that need to figure out how long a file is, for whatever reason, that in almost every case I've seen I see the following: [Please excuse the pseudo code] FileLock := Lock( FileName); new( FileInfo); Examine( FileLock, FileInfo); Length := FileInfo^.FileLength; dispose( FileInfo); UnLock( FileLock); FileHandle := Open( FileName); Read( FileHandle, buffer, Length); Close( FileHandle); However, I do the following: FileHandle := Open( FileName); Toss := Seek( FileHandle, 0, ModeFromEOF); Length := Seek( FileHandle, 0, ModeFromBegin); Read( FileHandle, buffer, Length); Close( FileHandle); My method has numerous advantages, and as far as I can tell the seeks are logical, they don't get physical unless you actually try to read/write something ie they just move the active file position thingie. Is there something everyone else seems to know that I don't??? Just curious. And to make the net.gods := happy... Please respond via E-Mail and I will summarize to the net. :) If you expect a response to your E-Mail letter to me make sure you give me a ! style address or a @ style address. If you give me an @ style make sure the site is registered :). I've found that the addresses collected by the messages as it winds it way to me are in most cases USELESS. If you haven't heard back from me it's probably because my reply to you came back, maybe more than once! I give up after three attempts to make a reply. Scott Turner -- L5 Computing, the home of Merlin, Arthur, Excalibur and the CRAM. GEnie: JST | UUCP: stride!l5comp!scotty | 12311 Maplewood Ave; Edmonds WA 98020 If Motorola had wanted us to use BPTR's they'd have built in shifts on A regs [ BCPL? Just say *NO*! ] (I don't smoke, send flames to /dev/aleale