toupper _toupper, towupper

Convert character to uppercase.

inttoupper(intc**);**

int_toupper(intc**);**

inttowupper(wint_tc**);**

Routine Required Header Compatibility
toupper <stdlib.h> and <ctype.h> ANSI, Win 95, Win NT
_toupper <ctype.h> Win 95, Win NT
towupper <ctype.h> or <wchar.h> ANSI, Win 95, Win NT

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

Each of these routines converts a copy of c, if possible, and returns the result.

If c is a wide character for which iswlower is true and there is a corresponding wide character for which iswupper is true, towupper returns the corresponding wide character; otherwise, towupper returns c unchanged.

There is no return value reserved to indicate an error.

Parameter

c

Character to convert

Remarks

Each of these routines converts a given lowercase letter to an uppercase letter if possible and appropriate.

Data Conversion Routines

See Also   is Routines, to Functions Overview

Example

/* TOUPPER.C: This program uses toupper and tolower to
 * analyze all characters between 0x0 and 0x7F. It also
 * applies _toupper and _tolower to any code in this
 * range for which these functions make sense.
 */

#include <conio.h>
#include <ctype.h>
#include <string.h>

char msg[] = "Some of THESE letters are Capitals\r\n";
char *p;

void main( void )
{
   _cputs( msg );

   /* Reverse case of message. */
   for( p = msg; p < msg + strlen( msg ); p++ )
   {
      if( islower( *p ) )
         _putch( _toupper( *p ) );
      else if( isupper( *p ) )
         _putch( _tolower( *p ) );
      else
         _putch( *p );
   }
}

Output

Some of THESE letters are Capitals
sOME OF these LETTERS ARE cAPITALS