Welcome, Guest. Please login or register.

Author Topic: Retrieving FileSize in bytes  (Read 3016 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline selco

  • Jr. Member
  • **
  • Join Date: Jul 2002
  • Posts: 87
    • Show all replies
    • http://selco.da.ru
Re: Retrieving FileSize in bytes
« on: January 12, 2004, 03:40:35 PM »
Hello,
Let me give you another solution:

long filesize(FILE *stream)
{
        long curpos, length;
        curpos = ftell(stream);
                  fseek(stream, 0L, SEEK_END);
        length = ftell(stream);
        fseek(stream, curpos, SEEK_SET);
                  return length;
}

This is plain ANSI-C without Amiga-dependencies, so it should work on all machines...
To call it just open your file with fopen() and give the FilePointer to the function. After that you close the file again with fclose().

Hope that helps...