HP 3000 Manuals

tolower, _tolower [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation


HP C/iX Library Reference Manual

tolower, _tolower 

Converts an uppercase letter to lowercase.

Syntax 

     #include <ctype.h>
     int tolower (int c);

Parameters 

c             An argument to be converted to lowercase.

Return Values 

x                     The lowercase letter that corresponds with c.  If c 
                      is not an uppercase letter and the function is
                      called, c is returned unchanged.  If c is not an
                      uppercase letter and the macro is called, the
                      results are undefined.

Description 

This conversion routine that downshifts ASCII characters is implemented
both as a function and as a macro.  The tolower function and _tolower
macro have a domain the range of getc() (the integers from -1 through
255).  If the argument passed in c represents an uppercase letter,
tolower() returns the corresponding lowercase letter.  All other
arguments in the domain are returned unchanged.

The _tolower macro accomplishes the same thing as the function, but has a
restricted domain and is faster.  The _tolower macro requires a lowercase
letter as its argument.  Arguments outside the domain cause undefined
results.


NOTE The tolower function and macro do not work with foreign character sets.
Example The following code fragment might appear in the scanner of a case-insensitive compiler, where all source input is mapped to lowercase before any processing is performed: unsigned char *ps; while (*ps != '\0'){ *ps = tolower(*ps); &+&+ps; } See Also toupper(), ANSI C 4.3.2.1, POSIX.1 8.1


MPE/iX 5.0 Documentation