Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!argosy!jay From: jay@argosy.UUCP (Jay O'Conor) Newsgroups: comp.sys.mac.programmer Subject: What's wrong with this??? Message-ID: <1209@argosy.UUCP> Date: 4 Apr 91 20:55:47 GMT Sender: news@argosy.UUCP Reply-To: jay@armada.UUCP (Jay O'Conor) Organization: MasPar Computer Corporation, Sunnyvale, CA Lines: 21 Here's a problem that has been bugging me for a whole day now. What is wrong with this statement? fprintf( logfile, (isascii(*cp) && isprint(*cp)) ? "[%c]" : [%02x]", *cp); The problem I'm having is the result of isprint() doesn't seem to be working. *cp is defined as an unsigned char *. This is using MPW3.2b3 (from the ETO CD-ROM). If I split the isascii() and isprint() out into seperate lines, assigning their result to two temporary variables, then logical and the two results in the fprintf line, then everything is fine. Naturally, I'm not crazy about having two variables just to deal with this. The purpose of this line is to print printable characters as ascii, but print unprintable ones as hex. BTW, The statement works in Think C. Thanks Jay O'Conor MasPar Computer Corporation jay@maspar.com