| <html lang="en"> |
| <head> |
| <title>wctomb - Untitled</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Untitled"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="Stdlib.html#Stdlib" title="Stdlib"> |
| <link rel="prev" href="wcstombs.html#wcstombs" title="wcstombs"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="wctomb"></a> |
| <p> |
| Previous: <a rel="previous" accesskey="p" href="wcstombs.html#wcstombs">wcstombs</a>, |
| Up: <a rel="up" accesskey="u" href="Stdlib.html#Stdlib">Stdlib</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">2.47 <code>wctomb</code>—minimal wide char to multibyte converter</h3> |
| |
| <p><a name="index-wctomb-109"></a><strong>Synopsis</strong> |
| <pre class="example"> #include <stdlib.h> |
| int wctomb(char *<var>s</var>, wchar_t <var>wchar</var>); |
| |
| </pre> |
| <p><strong>Description</strong><br> |
| When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming |
| implementation of <code>wctomb</code>. The |
| only “wide characters” recognized are single bytes, |
| and they are “converted” to themselves. |
| |
| <p>When _MB_CAPABLE is defined, this routine calls <code>_wctomb_r</code> to perform |
| the conversion, passing a state variable to allow state dependent |
| decoding. The result is based on the locale setting which may |
| be restricted to a defined set of locales. |
| |
| <p>Each call to <code>wctomb</code> modifies <code>*</code><var>s</var> unless <var>s</var> is a null |
| pointer or _MB_CAPABLE is defined and <var>wchar</var> is invalid. |
| |
| <p><br> |
| <strong>Returns</strong><br> |
| This implementation of <code>wctomb</code> returns <code>0</code> if |
| <var>s</var> is <code>NULL</code>; it returns <code>-1</code> if _MB_CAPABLE is enabled |
| and the wchar is not a valid multi-byte character, it returns <code>1</code> |
| if _MB_CAPABLE is not defined or the wchar is in reality a single |
| byte character, otherwise it returns the number of bytes in the |
| multi-byte character. |
| |
| <p><br> |
| <strong>Portability</strong><br> |
| <code>wctomb</code> is required in the ANSI C standard. However, the precise |
| effects vary with the locale. |
| |
| <p><code>wctomb</code> requires no supporting OS subroutines. |
| |
| <p><br> |
| |
| </body></html> |
| |