_toupper

De RAD Studio
Aller à : navigation, rechercher

Remonter à Ctype.h - Index


Header File

ctype.h

Category

Conversion Routines

Prototype

int _toupper(int ch);

Description

Translates characters to uppercase.

_toupper is a macro that does the same conversion as toupper, except that it should be used only when ch is known to be lowercase (a to z).

To use _toupper, you must include ctype.h.

Return Value

_toupper returns the converted value of ch if it is lowercase; otherwise, the result is undefined.

Example



 #include <string.h>
 #include <stdio.h>
 #include <ctype.h>
 int main(void)
 {
    int length, i;
    char *string = "this is a string.";
    length = strlen(string);
    for (i = 0; i < length; i++) {
       if ((string[i] >= 'a') && (string[i] <= 'z')){
          string[i] = _toupper(string[i]);
          }
    }
    printf("%s\n",string);
    return 0;
 }



Portability



POSIX Win32 ANSI C ANSI C++

+