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

  1. /*-----------------------------------------------------------------------*
  2.  * filename - puts.c
  3.  *
  4.  * function(s)
  5.  *        puts - 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 <string.h>
  19. #include <_stdio.h>
  20.  
  21. /*---------------------------------------------------------------------*
  22.  
  23. Name            puts - outputs a string to stdout
  24.  
  25. Usage           int puts(const char *string);
  26.  
  27. Prototype in    stdio.h
  28.  
  29. Description     puts copies the null-terminated string string to the
  30.                 standard output stream stdout and appends a newline character.
  31.  
  32. Return value    On successful completion, puts returns the
  33.                 last character written. Otherwise, a value of EOF is
  34.                 returned.
  35.  
  36. *---------------------------------------------------------------------*/
  37. int _FARFUNC puts( const register char *s )
  38.   {
  39.   int len;
  40.  
  41.   if (s == NULL)
  42.     return (0);
  43.  
  44.   len = strlen( s );
  45.  
  46.   if( __fputn( s, len, stdout) != len )  return( EOF );
  47.  
  48.   return( ((fputc ('\n', stdout) != '\n')  ? EOF : '\n') );
  49.   }
  50.