home *** CD-ROM | disk | FTP | other *** search
/ nisttime.carsoncity.k12.mi.us / nisttime.carsoncity.k12.mi.us.tar / nisttime.carsoncity.k12.mi.us / pub / autolock / putautolock.c < prev    next >
C/C++ Source or Header  |  2003-12-09  |  2KB  |  48 lines

  1. #include <stdio.h>
  2. #include "autolock.h"
  3. void putautolock(FILE **lop,struct autolockst autolock[])
  4. {
  5. int j;
  6. /*
  7.     this subroutine writes structure data from 
  8.     the structure pointed to by autolock to the output
  9.     file.  the destination file was opened by the caller 
  10.     via fopen and lop is the file structure returned from 
  11.     that fopen
  12.     if this subroutine finds a record with a day number of 0,
  13.     then it writes that record out and returns immediately, 
  14.     since there are data records after that.  There is no
  15.     point writing out lots and lots of zeroes.
  16. */
  17.     for(j=0; j<NUMSTATES; j++)
  18.        {
  19.        fprintf(*lop,L5FMT,autolock[j].day);
  20.        if(autolock[j].day == 0)
  21.         autolock[j].fday =autolock[j].mode    =autolock[j].x=
  22.         autolock[j].rms  =autolock[j].rms_avg = autolock[j].nval =
  23.         autolock[j].y=
  24.         autolock[j].d    =autolock[j].srv  =autolock[j].flags=
  25.         autolock[j].waitn=
  26.         autolock[j].waitx =autolock[j].errx=autolock[j].ybar=
  27.         autolock[j].fcon=autolock[j].sumerr=0;
  28.        fprintf(*lop,L8FMT,autolock[j].fday);
  29.        fprintf(*lop," %2d", autolock[j].mode);
  30.        fprintf(*lop," % .3le",autolock[j].x);
  31.        fprintf(*lop," % .3e", autolock[j].rms);
  32.        fprintf(*lop," % .3e", autolock[j].rms_avg);
  33.        fprintf(*lop," %2d", autolock[j].nval);
  34.        fprintf(*lop," % .5le",autolock[j].y);
  35.        fprintf(*lop," % .5le",autolock[j].d);
  36.        fprintf(*lop," %4d", autolock[j].srv);
  37.        fprintf(*lop," %4d", autolock[j].flags);
  38.        fprintf(*lop," %5d", autolock[j].waitn);
  39.        fprintf(*lop," %5d", autolock[j].waitx);
  40.        fprintf(*lop," % .3le",autolock[j].errx);
  41.        fprintf(*lop," % .3le",autolock[j].ybar);
  42.        fprintf(*lop," %5d", autolock[j].fcon);
  43.        fprintf(*lop," % .3le",autolock[j].sumerr);
  44.        fprintf(*lop,"\n");
  45.        if(autolock[j].day == 0) break;    /*that's all folks*/
  46.     }
  47. }
  48.