> I'm wondering what the alternatives for snprintf are in ISO 9899, as
> it looks like C99 is the earliest standard that includes it.
ISO 9899 is the C standard. The current edition was published in 2011.
That edition supersedes the 1990 and 1999 editions.
I think you meant to ask about C90.
> What I'm trying to do, is print an ASCII string to the console, and
> I need to generate the entire string first, before I convert it to
> for example UTF-8 wide char. In other words, replace the printf
> things that are already in a program with something that can output
> Unicode.
C90 didn't have snprintf; that's why it was added to the language
in 1999. If you need to use snprintf, you can probably just go
ahead and use it. Most C implementations provide it, even if they
don't fully support C99.
If you can't use snprintf, you might be able to compute a maximum
size for the target array. sprintf doesn't check for a buffer
overrun but you can get away without that check if you're *very*
careful.
But I think you're a bit confused about UTF-8. There's no such
thing as a "UTF-8 wide char". UTF-8 is a representation of
Unicode that uses one to four octets for each Unicode code point.
ASCII is a 7-bit character set, usually represented using one
octet per character. ASCII text *is* UTF-8 text (that was a major
requirement for the design of UTF-8). If you have an ASCII string
that you want to print to the console, just print it.
You'll need to be more specific about what you're trying to do.
--
Keith Thompson (The_Other_Keith)
ks...@mib.org <
http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"