Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!rochester!kodak!grodberg From: grodberg@kodak.UUCP Newsgroups: comp.lang.c Subject: Printf format strings Message-ID: <782@kodak.UUCP> Date: Fri, 3-Apr-87 18:27:35 EST Article-I.D.: kodak.782 Posted: Fri Apr 3 18:27:35 1987 Date-Received: Sun, 5-Apr-87 08:14:05 EST Reply-To: grodberg@kodak.UUCP (Jeremy Grodberg) Distribution: world Organization: Eastman Kodak Co, Rochester, NY Lines: 13 Keywords: printf, print formatting. In our Sun C compiler, printf("%#07x", 27); prints "0x000001b" (9 characters) while printf("%#7x", 27); prints " 0x1b" (7 characters). Is this a) common, b) "correct", c) discussed in the ANSI standard? My feeling is that the two format strings should always generate 7 characters (unless more are necessary to represent the number), and losing this battle I would at least hope they would both generate 9 characters (either the "0x" is part of the field width or it isn't). -- Jeremy Grodberg Usenet: ...rochester!kodak!grodberg Arpa: grodberg@kodak or kodak!grodberg@rochester