"Walter Roberson" <> wrote in message
news:e57imu$cj9$...
> If you have a (narrow) char string, you cannot convert it to
> a wchar_t string by setting your locale to "C" and then passing
> the string through mbstowcs(). That's because the "C" locale specifies
> a -particular- character encoding, and that encoding might not match
> the encoding of the execution character set, so mbstowcs() might
> map the characters to something unexpected, or could even fail
> (if the execution character set happened to use encodings that
> were incompatible with the encoding structure for the C locale
> character set.)
>
> Thus, in order to convert a char string into a wider string, you
> have to copy the chars one by one into an array of wchar_t .
> If you need to work with Unicode or utf-16 or whatever after that,
> then wcstombs() is what you should look at.
Please pardon the tangent...
Does anyone have a reference to _how to actually use_ the multi-byte / wide
functions in a real program? I've studied the documentation available, and
I can't make heads or tails of them or figure out how to do what I want.
Specifically, I'm looking for a way to read from a text file that is in one
multibyte encoding, manipulate the contents as wide chars, then write to a
text file that is in a _different_ multibyte encoding. I'm sure it's
simple, but I can't find any examples of code using the standard C
functions, just stuff like <OT>libiconv</OT>.
S
--
Stephen Sprunk "Stupid people surround themselves with smart
CCIE #3723 people. Smart people surround themselves with
K5SSS smart people who disagree with them." --Aaron Sorkin
*** Posted via a free Usenet account from
http://www.teranews.com ***