//==================================================== file = filter1.c ===== //= Program to filter short idle times out of idle1.c output = //=========================================================================== //= Notes: = //= 1) Input is from stdin and output is to stdout = //= 2) Minimum idle time to filter is set in #define = //=-------------------------------------------------------------------------= //= Example input: = //= Current local time is: Wed May 02 21:46:11 2007 = //= 0.047 0.079 = //= 0.844 0.125 = //= 0.891 0.062 = //= 3.547 2.672 = //= 3.563 0.031 = //= 6.141 2.593 = //= 6.156 0.031 = //= 6.172 0.032 = //= 6.250 0.032 = //= 9.828 3.594 = //= 14.125 0.094 = //= 14.141 0.031 = //=-------------------------------------------------------------------------= //= Example output: = //= Current local time is: Wed May 02 21:46:11 2007 = //= 3.547000 2.672000 = //= 6.141000 2.593000 = //= 9.828000 3.594000 = //=-------------------------------------------------------------------------= //= Build: bcc32 filter1.c = //=-------------------------------------------------------------------------= //= Execute: filter1 < inFile > outFile = //=-------------------------------------------------------------------------= //= Author: Ken Christensen = //= University of South Florida = //= WWW: http://www.csee.usf.edu/~christen = //= Email: christen@csee.usf.edu = //=-------------------------------------------------------------------------= //= History: KJC (05/02/07) - Genesis = //=========================================================================== //----- Include files ------------------------------------------------------- #include // Needed for printf() #include // Needed for atof() //----- Defines ------------------------------------------------------------- #define MIN_IDLE 1.0 // Filter-out idles (seconds) less than this //=========================================================================== //= Main program = //=========================================================================== void main() { char inString[255]; // Input string char valString1[255]; // Value string #1 char valString2[255]; // Value string #2 double timeStamp; // Relative time from start double idleTime; // Idle time // Get the header string and output it gets(inString); printf("%s \n", inString); // Filter the idle times while(1) { gets(inString); if(feof(stdin)) break; sscanf(inString, "%s %s", valString1, valString2); timeStamp = atof(valString1); idleTime = atof(valString2); if (idleTime >= MIN_IDLE) printf("%f %f \n", timeStamp, idleTime); } }