MirBSD manpage: xambsntowcs(3), xambstowcs(3), xawcsntombs(3), xawcstombs(3)

XAMBSTOWCS(3)              BSD Programmer's Manual               XAMBSTOWCS(3)


     xambsntowcs, xambstowcs, xawcsntombs, xawcstombs - convert between multi-
     byte and wide strings with checked allocation


     #include <mbfun.h>

     wchar_t *
     xambsntowcs(const char *s, size_t n);

     wchar_t *
     xambstowcs(const char *s);

     char *
     xawcsntombs(const wchar_t *s, size_t n);

     char *
     xawcstombs(const wchar_t *s);


     The xambsntowcs() and xambstowcs() 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
     xawcsntombs() and xawcstombs() 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 xambsntowcs() and
     xawcsntombs() functions convert at most n characters; the xambstowcs()
     and xawcstombs() functions convert the entire string.


     xambsntowcs() and xambstowcs() return the newly allocated wide character
     string. xawcsntombs() and xawcstombs() return the newly allocated multi-
     byte character string. Failure to allocate enough memory will terminate
     the calling program, xmalloc style, with errorlevel 1 and an appropriate
     error message. Passing a NULL pointer results in undefined behaviour.


     mbsrtowcs(3), wcsrtombs(3)


     The xambsntowcs, xambstowcs, xawcsntombs, and xawcstombs functions are
     MirBSD BSD extensions and first appeared in MirBSD #11.


     Thorsten Glaser <tg@mirbsd.de> wrote the entire internationalisation im-
     plementation in MirBSD. He is also the steward for the OPTU encoding.


     These functions were originally introduced without the leading 'x' but
     renamed because they abort on memory allocation error, which is not suit-
     able for a library. Eventually, the unprefixed versions shall be returned
     to this library which will then return NULL on memory allocation error.

     Future directions include switching to 21-bit UCS without notice.

MirBSD #10-current               July 7, 2021                                1

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung