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