1<html lang="en"> 2<head> 3<title>wctomb - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Stdlib.html#Stdlib" title="Stdlib"> 9<link rel="prev" href="wcstombs.html#wcstombs" title="wcstombs"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<meta http-equiv="Content-Style-Type" content="text/css"> 12<style type="text/css"><!-- 13 pre.display { font-family:inherit } 14 pre.format { font-family:inherit } 15 pre.smalldisplay { font-family:inherit; font-size:smaller } 16 pre.smallformat { font-family:inherit; font-size:smaller } 17 pre.smallexample { font-size:smaller } 18 pre.smalllisp { font-size:smaller } 19 span.sc { font-variant:small-caps } 20 span.roman { font-family:serif; font-weight:normal; } 21 span.sansserif { font-family:sans-serif; font-weight:normal; } 22--></style> 23<link rel="stylesheet" type="text/css" href="../cs.css"> 24</head> 25<body> 26<div class="node"> 27<a name="wctomb"></a> 28<p> 29Previous: <a rel="previous" accesskey="p" href="wcstombs.html#wcstombs">wcstombs</a>, 30Up: <a rel="up" accesskey="u" href="Stdlib.html#Stdlib">Stdlib</a> 31<hr> 32</div> 33 34<h3 class="section">2.47 <code>wctomb</code>—minimal wide char to multibyte converter</h3> 35 36<p><a name="index-wctomb-109"></a><strong>Synopsis</strong> 37<pre class="example"> #include <stdlib.h> 38 int wctomb(char *<var>s</var>, wchar_t <var>wchar</var>); 39 40</pre> 41 <p><strong>Description</strong><br> 42When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming 43implementation of <code>wctomb</code>. The 44only “wide characters” recognized are single bytes, 45and they are “converted” to themselves. 46 47 <p>When _MB_CAPABLE is defined, this routine calls <code>_wctomb_r</code> to perform 48the conversion, passing a state variable to allow state dependent 49decoding. The result is based on the locale setting which may 50be restricted to a defined set of locales. 51 52 <p>Each call to <code>wctomb</code> modifies <code>*</code><var>s</var> unless <var>s</var> is a null 53pointer or _MB_CAPABLE is defined and <var>wchar</var> is invalid. 54 55 <p><br> 56<strong>Returns</strong><br> 57This implementation of <code>wctomb</code> returns <code>0</code> if 58<var>s</var> is <code>NULL</code>; it returns <code>-1</code> if _MB_CAPABLE is enabled 59and the wchar is not a valid multi-byte character, it returns <code>1</code> 60if _MB_CAPABLE is not defined or the wchar is in reality a single 61byte character, otherwise it returns the number of bytes in the 62multi-byte character. 63 64 <p><br> 65<strong>Portability</strong><br> 66<code>wctomb</code> is required in the ANSI C standard. However, the precise 67effects vary with the locale. 68 69 <p><code>wctomb</code> requires no supporting OS subroutines. 70 71 <p><br> 72 73 </body></html> 74 75