00001 #include "sadie.h" 00002 00003 int 00004 FILESIZE (name) 00005 unsigned char *name; /* I String, containing the name of the disk file. */ 00006 { 00007 int size = 0; 00008 FILE *fp = NULL; 00009 char ch; 00010 00011 /* open file */ 00012 if (!(fp = fopen (name, "r"))) 00013 { 00014 goto the_end; 00015 } 00016 00017 while ((ch = getc (fp)) != EOF) 00018 { 00019 size++; 00020 } 00021 00022 the_end: 00023 if (fp) 00024 { 00025 if (fclose (fp)) 00026 { 00027 size = 0; 00028 } 00029 } 00030 00031 return size; 00032 }