🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1047

Re: printf format

#1047
From: Karl Heuer
Date: Wed, 13 Dec 1989 22:00
20 lines
1469 bytes
In article <5761@ozdaltx.UUCP> root@ozdaltx.UUCP (root) writes:
>[Can printf() format numbers with embedded commas?]

Not in K&R or ANSI C, though it's conceivable that some vendor has added it as
an extension.

You may be thinking of the localization features of ANSI C.  These provide
some support for determining what the local convention is (e.g. where to place
the commas, what the currency symbol looks like, etc.), but there's no library
function that actually makes use of any this information (except for the
decimal-point character).

>If printf does not have this ability, it should be added.

I think a better idea is to have a separate function to do this type of
formatting, then print it with %s.  (Just like you have to do with a time_t,
for example, to make it print in a human-readable format.)  I suspect this is
what the Committee had in mind.

Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint
Technical Details
Message-ID: <15430@haddock.ima.isc.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!purdue!bu-cs!husc6!spdcc!ima!haddock!karl
References: <5761@ozdaltx.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!purdue!bu-cs!husc6!spdcc!ima!haddock!karl
From: karl@haddock.ima.isc.com (Karl Heuer)
Newsgroups: comp.std.c,comp.lang.c,comp.unix.xenix
Subject: Re: printf format
Message-ID: <15430@haddock.ima.isc.com>
Date: 13 Dec 89 22:00:38 GMT
References: <5761@ozdaltx.UUCP>
Reply-To: karl@haddock.ima.isc.com (Karl Heuer)
Followup-To: comp.std.c
Organization: Interactive Systems, Cambridge, MA 02138-5302
Lines: 20