//====================================================== file = scale.c ===== //= Program to scale a series X of size N = //=========================================================================== //= Notes: = //= 1) Input from input file "in.dat" to stdin (see example below) = //= * Comments are bounded by "&" characters at the beginning and = //= end of the comment block = //= 2) Output is to stdout = //= 3) Must manually set SCALE_VALUE = //=-------------------------------------------------------------------------= //= Example "in.dat" file: = //= = //= & Sample series of data which can be integers or reals. = //= There are 3 values in this file. & = //= 51 = //= 38 = //= 45 = //=-------------------------------------------------------------------------= //= Example output (for above "in.dat" and SCALE_VALUE = 10.0) = //= = //= ------------------------------------------------- scale.c ----- = //= 510.000000 = //= 380.000000 = //= 450.000000 = //= --------------------------------------------------------------- = //=-------------------------------------------------------------------------= //= Build: gcc scale.c, bcc32 scale.c, cl scale.c = //=-------------------------------------------------------------------------= //= Execute: scale < in.dat = //=-------------------------------------------------------------------------= //= Author: Kenneth J. Christensen = //= University of South Florida = //= WWW: http://www.csee.usf.edu/~christen = //= Email: christen@csee.usf.edu = //=-------------------------------------------------------------------------= //= History: KJC (05/11/00) - Genesis = //=========================================================================== //----- Include files ------------------------------------------------------- #include // Needed for printf() and feof() #include // Needed for exit() and atof() #include // Needed for strcmp() //----- Defines ------------------------------------------------------------- #define MAX_SIZE 1600000L // Maximum size of time series data array #define SCALE_VALUE 10.0 // Scaling value //----- Globals ------------------------------------------------------------- double X[MAX_SIZE]; // Time series read from "in.dat" long int N; // Number of values in "in.dat" //----- Function prototypes ------------------------------------------------- void load_X_array(void); // Load X array //=========================================================================== //= Main program = //=========================================================================== void main(void) { long int i; // Loop counter // Load the series X printf("------------------------------------------------- scale.c -----\n"); load_X_array(); // Output the new scaled time series for (i=0; i= MAX_SIZE) { printf("*** ERROR - greater than %ld data values \n", MAX_SIZE); exit(1); } } // End-of-file escape end: return; }