Finding file size
Tom,
Here's a bit of code I use to get the size of a file…
long fsize(char *file)
{
struct FileInfoBlock __aligned FBlock;
BPTR FLock;
if(!(FLock = Lock(file,ACCESS_READ))) /* try to lock file */
return NULL;
if(!Examine(FLock,&FBlock))
{
UnLock(FLock);
return NULL;
}
UnLock(FLock);
return(FBlock.fib_Size);
}
.. note that the FileInfoBlock structure must be aligned (or could be
obtained by AllocMem()). Note also that you may already have the Lock you
need, so you might could just do the Examine(). I'm not sure what you mean
by "I don't want to use an AmigaDOS command"… the information about the
file _has_ to come from AmigaDOS (or did you mean not wanting to execute a
C: command?).
Anyway, hope this helps…
– Keith