Conversion functions
ANSI C provides five library functions that manage
multibyte characters and wide characters:
mblen()
|
length of next multibyte character
|
mbtowc()
|
convert multibyte character to wide character
|
wctomb()
|
convert wide character to multibyte character
|
mbstowcs()
|
convert multibyte character string to wide character string
|
wcstombs()
|
convert wide character string to multibyte character string
|
The behavior of all of these functions
depends on the current locale.
NOTE:
See the setlocale()
function in
``Internationalization''.
It is expected that vendors providing compilation systems
targeted to this market will supply many more string-like
functions to simplify the handling of wide character strings.
However, for most application programs,
there is no need to convert any multibyte characters
to or from wide characters.
Programs such as diff,
for example,
will read in and write out multibyte characters,
needing only to check for an exact byte-for-byte match.
More complicated programs (such as grep)
that use regular expression pattern matching, may
need to understand multibyte characters,
but only the common set of functions that
manages the regular expression needs this knowledge.
The program grep
itself requires no other special multibyte character handling.
Next topic:
C language features
Previous topic:
Wide characters
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003