From: | Colin Wenzel |
Date: | 14 Jul 2000 at 02:50:53 |
Subject: | Re: ExamineFH() Problems |
On 14-Jul-00, Alexander Niven-Jenkins wrote:
> Hiya radiat-r,
>> If you just need the size of the file you also can do it another
>> way. As you already opened the file, just Seek() to the end to get
>> the position of the last byte, which also represents the size of the
>> file. Looks like this:
>> Seek(fh, 0, OFFSET_END) // move to end of file
>> file_size=Seek(fh, 0, OFFSET_BEGINNING);
> Don't do this :-) Although it looks a nice idea, try it on a 750mb
> CD image file :-)
Seek() has always been the "pseudo official" way to find just
the file size, ever since whenever....
All it does is move the cursor pointer, nothing else...
If you have a drive full of 750Mb files, then you deserve it. (:/
But if you ONLY want the file size, it certainly has very low code overhead.
*AND*... it is perfectly safe & needs no memory allocations.
However, If you need more information than the file size,
or intend Seek()ing the crap out of an entrire directory of files,
or have a drive full of 750Mb files,
then most certainly use Examine()....
For the: "/check_my_size_while_I_have_it_open/" situation,
Seek() wins hands down....
Regards
Colin Wenzel. Australia.
EMAIL: colstv@hotkey.net.au
URL: http://www.hotkey.net.au/~colstv/
ICQ: 17608330
AMIGA: 4000T, 68060/50, 150Mb RAM,
OS 3.5, Spectrum Gfx Card.
_________________________________________
------------------------------------------------------------------------
Get a NextCard Visa, in 30 seconds!
1. Fill in the brief application
2. Receive approval decision within 30 seconds
3. Get rates as low as 2.9% Intro or 9.9% Fixed APR
http://click.egroups.com/1/6631/1/_/451227/_/963541024/
------------------------------------------------------------------------