Welcome, Guest. Please login or register.

Author Topic: The size of a file  (Read 2115 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline srg86Topic starter

  • Full Member
  • ***
  • Join Date: Aug 2004
  • Posts: 211
    • Show only replies by srg86
    • http://www.aopp12.dsl.pipex.com
The size of a file
« on: May 03, 2005, 07:36:50 PM »
Hi

How do I find out the size of a file is using AmigaDOS calls (I don't think there is anything to do this in the standard C library but I could be wrong).

thanks
srg
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: The size of a file
« Reply #1 on: May 03, 2005, 07:59:48 PM »
dos.library/Examine
dos.library/ExamineFH

Occasionally also code using dos.library/Seek can be seen, but this method is really really slow with FFS and large files, and should be avoided.
 

Offline Fats

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 672
    • Show only replies by Fats
Re: The size of a file
« Reply #2 on: May 03, 2005, 07:59:57 PM »
You can do it in ANSI-C on an open file like this:

fseek(f, 0, SEEK_END);
size = ftell(f);


the conversion to Amiga function calls I leave as an exercise :-)

greets,
Staf.
Trust me...                                              I know what I\'m doing
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: The size of a file
« Reply #3 on: May 03, 2005, 08:03:05 PM »
@Fats

...which is really slow with FFS and large files. Should be avoided.

If you don't need ANSI-C, use fstat (or stat). Even SAS/C linklibs have it.
 

Offline srg86Topic starter

  • Full Member
  • ***
  • Join Date: Aug 2004
  • Posts: 211
    • Show only replies by srg86
    • http://www.aopp12.dsl.pipex.com
Re: The size of a file
« Reply #4 on: May 03, 2005, 09:09:53 PM »
I've found Examine, but I can't find what header file ExamineFH is in.

srg
 

Offline Doobrey

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 1876
    • Show only replies by Doobrey
    • http://www.doobreynet.co.uk
Re: The size of a file
« Reply #5 on: May 03, 2005, 11:31:13 PM »
It`s in dos.h , the same as Examine ;)
On schedule, and suing
 

Offline srg86Topic starter

  • Full Member
  • ***
  • Join Date: Aug 2004
  • Posts: 211
    • Show only replies by srg86
    • http://www.aopp12.dsl.pipex.com
Re: The size of a file
« Reply #6 on: May 04, 2005, 02:08:57 PM »
doh!!!!!!!!!

srg

P.S. doh!!!!!