/********************* rexx ****************************************/ /* (c) Copyright Roger Lacroix 1991 | | | | Designed, developed and programmed by Roger Lacroix | +-------------------------------------------------------------------+ | | | FileSize v1.0 | | | | FileSize returns the length of the file given as its argument. | | The file is required to be opened already. Note that the position | | witin the file is preserved through the call. This function will | | only work properly with fixed format files. | +------------------------------------------------------------------*/ long FileSize (FILE *file) { auto long int size = 0L; /* Size of the file. */ auto long int current_position; /* Postion when called. */ if (file != NULL) { current_position = ftell (file); fseek (file, 0L, SEEK_END); size = ftell (file) + 1; /* Offsets run 0 to (size - 1). */ fseek (file, current_position, SEEK_SET); } return (size); }