Is there a good example of how toupper() works?
Karl Heuer
karl at haddock.ima.isc.com
Fri Oct 19 07:49:00 AEST 1990
In article <1990Oct17.170914.683 at wpi.WPI.EDU> profesor at wpi.WPI.EDU (Matthew E Cross) writes:
>Nope, won't work - the return value of 'toupper' is undefined if the input is
>not a lowercase character.
Fixed in ANSI C.
For those who are using pre-ANSI systems where this doesn't hold, I recommend
coding in ANSI style, and writing your own ANSI-compatible headers and
libraries as needed. This minimizes the trauma when you finally graduate to
ANSI C. My personal ansi/ctype.h is:
#include "/usr//include/ctype.h"
#undef tolower
#undef toupper
#if defined(__STDC__)
extern int toupper(int);
extern int tolower(int);
#else
extern int toupper();
extern int tolower();
#endif
Karl W. Z. Heuer (karl at ima.isc.com or uunet!ima!karl), The Walking Lint
More information about the Comp.lang.c
mailing list