printf format

Karl Heuer karl at haddock.ima.isc.com
Thu Dec 14 09:00:38 AEST 1989


In article <5761 at ozdaltx.UUCP> root at 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 at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list