home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC1.ZIP / FPUTS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.2 KB  |  47 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - fputs.c
  3.  *
  4.  * function(s)
  5.  *        fputs - puts a string on a stream
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <stdio.h>
  18. #include <_stdio.h>
  19. #include <string.h>
  20.  
  21. /*---------------------------------------------------------------------*
  22.  
  23. Name            fputs - puts a string on a stream
  24.  
  25. Usage           #include <stdio.h>
  26.                 int fputs(const char *string, FILE *stream);
  27.  
  28. Prototype in    stdio.h
  29.  
  30. Description     copies the null-terminated string string to the named
  31.                 output stream; it does not append a newline character.
  32.  
  33. Return value    success : the last character written
  34.                 else    : EOF
  35.  
  36. *---------------------------------------------------------------------*/
  37. int _FARFUNC fputs (const register char *s, FILE *fp)
  38. {
  39.     register int len;
  40.  
  41.     if (s == NULL)
  42.         return (0);
  43.     if ((len = strlen(s)) == 0)
  44.         return (0);
  45.     return  __fputn (s, len, fp)  ?  *(unsigned char *)(s+len-1) : EOF;
  46. }
  47.