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

  1. /*-----------------------------------------------------------------------*
  2.  * filename - toupper.c
  3.  *
  4.  * function(s)
  5.  *        toupper - translates characters to upper-case
  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 <ctype.h>
  18.  
  19. /*---------------------------------------------------------------------*
  20.  
  21. Name            toupper - translates characters to upper-case
  22.  
  23. Usage           int toupper(int c);
  24.  
  25. Prototype in    toupper is a function that converts an integer c (in the range
  26.                 EOF to 255) to its upper-case value (if it was lower-case): all
  27.                 others are left unchanged.
  28.  
  29. Return value    returns the converted value of c, on success, and
  30.                 nothing on failure.
  31.  
  32. *---------------------------------------------------------------------*/
  33. #if defined(__FARFUNCS__)
  34. #include <_farfunc.h>
  35. #endif
  36.  
  37. int _CType toupper( int ch )
  38.   {
  39.   if( ch == -1 )  return( -1 );
  40.  
  41.   if( islower((unsigned char)ch) )
  42.     {
  43.     return( _toupper((unsigned char)ch) );
  44.     }
  45.   else
  46.     {
  47.     return( (unsigned char)ch );
  48.     }
  49.   }
  50.