Path: utzoo!attcan!uunet!munnari.oz.au!mel.dit.csiro.au!yarra!melba.bby.oz.au!zvs From: zvs@bby.oz.au (Zev Sero) Newsgroups: comp.lang.c Subject: Re: Is there a good example of how toupper() works? Message-ID: <1990Nov12.005245.14069@melba.bby.oz.au> Date: 12 Nov 90 00:52:45 GMT References: <1990Oct17.170914.683@wpi.WPI.EDU> <11021@hubcap.clemson.edu> <152580@felix.UUCP> <1990Nov7.043705.15051@robot.in-berlin.de> Sender: news@melba.bby.oz.au Organization: Burdett, Buckeridge and Young Ltd. Lines: 22 In-Reply-To: karl@robot.in-berlin.de's message of 7 Nov 90 04:37:05 GMT >>>>> On 7 Nov 90 04:37:05 GMT, karl@robot.in-berlin.de (Karl-P. Huestegge) said: Karl> One additional advice: Please don't use isascii() in text-functions, Karl> because this forbits all international chars > 127. Use isprint() Karl> instead (or whatever is appropriate). Unfortunately, in many implementations, including SunOS, the only ctype.h functions/macros that are guaranteed to work on chars >127 are isascii and toascii. If you want your code to work on such systems, i.e. you are doing things like c = isupper (c) ? tolower (c) : c; which is unnecessary in standard C, then you must also use isascii. c = isascii (c) && isupper (c) ? tolower (c) : c; To find out whether a character can safely be sent to a printer, in such an implementation, you must use if (isascii (c) && isprint (c)) otherwise, as I learned the hard way, your program will dump core. --- Zev Sero - zvs@bby.oz.au As I recall, zero was invented by Arabic mathematicians thousands of years ago. It's a pity it still frightens or confuses people. - Doug Gwyn