Fixed a few warnings.
[tangerine.git] / tools / dtdesc / c_iff / filesize.c
blob6a587784ef88c0cb7283ed40655fe6ba570898f2
1 /*
2 * c_iff - a portable IFF-parser
4 * Copyright (C) 2000, 2001 Joerg Dietrich
6 * This is the AROS-version of c_iff.
7 * It is distributed under the AROS Public License.
8 * But I reserve the right to distribute
9 * my own version under other licenses.
13 * filesize.c - get the size of a file
16 #include "c_iff.h"
18 /****** c_iff/FileSize ******************************************************
20 * NAME
21 * FileSize -- Get the Size of a file
23 * SYNOPSIS
24 * Size = FileSize( TheFile )
26 * size_t FileSize( FILE * )
28 * FUNCTION
29 * Returns the size of the given file.
31 * INPUTS
32 * TheFile - the file to count
34 * RESULT
35 * Size - size of the file
36 * or 0 when an error occurs
38 * EXAMPLE
40 * NOTES
41 * This is a support function. It has very few to do with c_iff.
43 * BUGS
45 * SEE ALSO
47 *****************************************************************************
49 * Private notes:
52 size_t FileSize(FILE *TheFile)
54 long Ret;
55 long CurPos;
57 if(!TheFile)
59 return(0);
62 CurPos=ftell(TheFile);
63 if(CurPos<0)
65 return(0);
68 if(fseek(TheFile, 0, SEEK_END))
70 return(0);
73 Ret=ftell(TheFile);
74 if(Ret<0)
76 return(0);
79 if(fseek(TheFile, CurPos, SEEK_SET))
81 return(0);
84 return((size_t) Ret);