home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 1.ddi / CLIB1.ZIP / TOLOWER.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  1.7 KB  |  49 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - tolower.c
  3.  *
  4.  * function(s)
  5.  *        tolower - translates characters to lower-case
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*[]------------------------------------------------------------[]*/
  9. /*|                                                              |*/
  10. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  11. /*|                                                              |*/
  12. /*|                                                              |*/
  13. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  14. /*|     All Rights Reserved.                                     |*/
  15. /*|                                                              |*/
  16. /*[]------------------------------------------------------------[]*/
  17.  
  18. #include <ctype.h>
  19.  
  20. /*---------------------------------------------------------------------*
  21.  
  22. Name            tolower - translates characters to lower-case
  23.  
  24. Usage           int tolower(int c);
  25.  
  26. Prototype in    ctype.h
  27.  
  28. Description     tolower is a function that converts an integer c (in the range
  29.                 EOF to 255) to its lower-case value (if it was upper-case): all
  30.                 others are left unchanged.
  31.  
  32. Return value    returns the converted value of c, on success, and nothing
  33.                 on failure.
  34.  
  35. *---------------------------------------------------------------------*/
  36. int _CType tolower( int ch )
  37.   {
  38.   if( ch == -1 )  return( -1 );
  39.  
  40.   if( isupper( (unsigned char)ch) )
  41.     {
  42.     return( _tolower((unsigned char)ch) );
  43.     }
  44.   else
  45.     {
  46.     return( (unsigned char)ch );
  47.     }
  48.   }
  49.