Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!linus!decvax!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.lang.c Subject: Re: What is wrong with this program? Message-ID: <2654@sun.uucp> Date: Fri, 16-Aug-85 23:43:02 EDT Article-I.D.: sun.2654 Posted: Fri Aug 16 23:43:02 1985 Date-Received: Mon, 19-Aug-85 21:42:15 EDT References: <117@graffiti.UUCP> <353@ttrdc.UUCP> <9940@ucbvax.ARPA> Distribution: net Organization: Sun Microsystems, Inc. Lines: 14 > Not really, you are forgetting that the format "%.8s" will > cause printf to print up to a null or 8 chars max. Unfortunately > this style of printf can not be used with sizeof for compile time > format changes without run time code support. True, you can't have the compiler generate the "printf" string, but you can do printf("%.*s", sizeof(thing), thing); since you can use "*" for a field width or precision and pick up the value from the argument list. Guy Harris