|
|
#include <ctype.h>int toascii(int c);
int todigit(int c);
int toint(int c);
int tolower(int c);
int _tolower(int c);
int toupper(int c);
int _toupper(int c);
The macros _toupper and _tolower have the same functionality of the functions on valid input, but the macros are faster because they do not do range checking. The _toupper macro takes a lowercase letter as its argument. The result is the corresponding uppercase letter. The _tolower macro takes an uppercase letter as its argument. The result is the corresponding lowercase letter. All other arguments cause unpredictable results.
The macro toascii yields its argument with all bits cleared that are not part of a standard ASCII character; it is intended for compatibility with other systems.
The macro todigit returns the digit character corresponding to its integer argument. The argument must be in the range 0-9, otherwise the behavior is undefined.
The macro toint returns the integer corresponding to the digit character supplied as its argument. The argument must be one of 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, otherwise the behavior is undefined.
toupper(*p++)Avoiding such argument calls helps to keep code portable.
The functions toupper and tolower are library functions. Their arguments are converted to integers. For this reason, care should be taken that character arguments are supplied as unsigned characters to avoid problems with sign-extension of 8-bit character values.
The todigit and toint macros are extensions, and may not be present on other systems.
toascii is conformant with:
X/Open Portability Guide, Issue 3, 1989 .
tolower and toupper are conformant with:
X/Open Portability Guide, Issue 3, 1989
;
ANSI X3.159-1989 Programming Language -- C
;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1)
;
and
NIST FIPS 151-1
.
_tolower and _toupper are conformant with:
X/Open Portability Guide, Issue 3, 1989 .