home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 21 / CD_ASCQ_21_040595.iso / dos / prg / c / freedos3 / source / jh_utils / outtee.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-07  |  583 b   |  27 lines

  1. #include <stdio.h>
  2. #include "freedos.h"
  3.  
  4. /***************************************************************************
  5.  * This function saves a copy of the input to pSave while simultaneously
  6.  * copying to the output.
  7.  *
  8.  * returns: TRUE if pIn was tee'd successfully, FALSE if pSave or pOut
  9.  * could not take input.
  10.  *
  11.  * maintainer: James Hall
  12.  */
  13.  
  14. int 
  15. outtee (FILE * pIn, FILE * pSave, FILE * pOut)
  16. {
  17.   char ch;
  18.  
  19.   /* Tee the output */
  20.  
  21.   while ((ch = fgetc (pIn)) != EOF)
  22.     if ((fputc (ch, pSave) == EOF) || (fputc (ch, pOut) == EOF))
  23.       return (FALSE);
  24.  
  25.   return (TRUE);
  26. }
  27.