home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 1 / FishNMoreVol1.bin / more / code_examples / librar / frite.c < prev    next >
Text File  |  1989-02-08  |  700b  |  31 lines

  1. /*--------------------------------------*/
  2. /*                    */
  3. /*            FRITE(X,X,X)        */
  4. /*                    */
  5. /* Outputs a character array to a file. */
  6. /* The first argument is the file    */
  7. /* descriptor. The second argument is    */
  8. /* the array name. The third argument is*/
  9. /* the size of the array.  The function */
  10. /* returns the actual number of bytes    */
  11. /* written.                */
  12. /*                    */
  13. /*--------------------------------------*/
  14. # include "stdio.h"
  15. frite(fd,a,b)
  16. int b;
  17. char a[];
  18. FILE *fd;
  19. {
  20.         int d,cnt,j;
  21.     cnt=0;
  22.         for (j=0;j<b;j++){
  23.              d=putc(a[j],fd);
  24.              if (d==-1)
  25.                  j=b;
  26.              else
  27.                  cnt++;
  28.     }
  29.     return(cnt);
  30. }
  31.