AMBSTOWCS(3) BSD Programmer's Manual AMBSTOWCS(3)NAME
ambsntowcs, ambstowcs, awcsntombs, awcstombs - convert between multibyte
and wide strings with allocation
SYNOPSIS
#define _ALL_SOURCE
#include <wchar.h>
wchar_t *
ambsntowcs(const char *s, size_t n);
wchar_t *
ambstowcs(const char *s);
char *
awcsntombs(const wchar_t *s, size_t n);
char *
awcstombs(const wchar_t *s);
DESCRIPTION
The ambsntowcs() and ambstowcs() functions convert the NUL-terminated
multibyte (MirOS OPTU-8 encoded) string s into a wide (MirOS OPTU-16
encoded) string, requesting just enough storage via calloc(3) from the
system to store the result, including a terminating WNUL character. The
awcsntombs() and awcstombs() functions convert the WNUL-terminated wide
(MirOS OPTU-16 encoded) string s into a multibyte (MirOS OPTU-8 encoded)
string, requesting just enough storage via malloc(3) from the system to
store the result, including a terminating NUL byte. The ambsntowcs() and
awcsntombs() functions convert at most n characters; the ambstowcs() and
awcstombs() functions convert the entire string.
RETURN VALUESambsntowcs() and ambstowcs() return the newly allocated wide character
string. awcsntombs() and awcstombs() return the newly allocated multibyte
character string. Failure to allocate enough memory will terminate the
calling programme, xmalloc style, with errorlevel 1 and an appropriate
error message. Passing a NULL pointer results in undefined behaviour.
SEE ALSOmbsrtowcs(3), wcsrtombs(3)HISTORY
The ambsntowcs, ambstowcs, awcsntombs, and awcstombs functions are
MirOS BSD extensions and first appeared in MirOS #11.
AUTHORS
Thorsten Glaser <tg@mirbsd.de> wrote the entire internationalisation im-
plementation in MirOS. He is also the steward for the OPTU encoding.
MirOS BSD #10-current August 13, 2009 1