Files
2024-02-19 00:21:47 -05:00

146 lines
5.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
<title>wctomb</title>
</head>
<body bgcolor="white">
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
</script>
<basefont size="3"> <a name="wctomb"></a> <a name="tag_03_855"></a><!-- wctomb -->
<!--header start-->
<center><font size="2">The Open Group Base Specifications Issue 6<br>
IEEE Std 1003.1-2001<br>
Copyright &copy; 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
<!--header end-->
<hr size="2" noshade>
<h4><a name="tag_03_855_01"></a>NAME</h4>
<blockquote>wctomb - convert a wide-character code to a character</blockquote>
<h4><a name="tag_03_855_02"></a>SYNOPSIS</h4>
<blockquote class="synopsis">
<p><code><tt>#include &lt;<a href="../basedefs/stdlib.h.html">stdlib.h</a>&gt;<br>
<br>
int wctomb(char *</tt><i>s</i><tt>, wchar_t</tt> <i>wchar</i><tt>);<br>
</tt></code></p>
</blockquote>
<h4><a name="tag_03_855_03"></a>DESCRIPTION</h4>
<blockquote>
<div class="box"><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"
border="0"> The functionality described on this reference page is aligned with the ISO&nbsp;C standard. Any conflict between the
requirements described here and the ISO&nbsp;C standard is unintentional. This volume of IEEE&nbsp;Std&nbsp;1003.1-2001 defers to
the ISO&nbsp;C standard. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></div>
<p>The <i>wctomb</i>() function shall determine the number of bytes needed to represent the character corresponding to the
wide-character code whose value is <i>wchar</i> (including any change in the shift state). It shall store the character
representation (possibly multiple bytes and any special bytes to change shift state) in the array object pointed to by <i>s</i> (if
<i>s</i> is not a null pointer). At most {MB_CUR_MAX} bytes shall be stored. If <i>wchar</i> is 0, a null byte shall be stored,
preceded by any shift sequence needed to restore the initial shift state, and <i>wctomb</i>() shall be left in the initial shift
state.</p>
<p><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> The
behavior of this function is affected by the <i>LC_CTYPE</i> category of the current locale. For a state-dependent encoding, this
function shall be placed into its initial state by a call for which its character pointer argument, <i>s</i>, is a null pointer.
Subsequent calls with <i>s</i> as other than a null pointer shall cause the internal state of the function to be altered as
necessary. A call with <i>s</i> as a null pointer shall cause this function to return a non-zero value if encodings have state
dependency, and 0 otherwise. Changing the <i>LC_CTYPE</i> category causes the shift state of this function to be unspecified.</p>
<p>The <i>wctomb</i>() function need not be reentrant. A function that is not required to be reentrant is not required to be
thread-safe. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
<p>The implementation shall behave as if no function defined in this volume of IEEE&nbsp;Std&nbsp;1003.1-2001 calls
<i>wctomb</i>().</p>
</blockquote>
<h4><a name="tag_03_855_04"></a>RETURN VALUE</h4>
<blockquote>
<p>If <i>s</i> is a null pointer, <i>wctomb</i>() shall return a non-zero or 0 value, if character encodings, respectively, do or
do not have state-dependent encodings. If <i>s</i> is not a null pointer, <i>wctomb</i>() shall return -1 if the value of
<i>wchar</i> does not correspond to a valid character, or return the number of bytes that constitute the character corresponding to
the value of <i>wchar</i>.</p>
<p>In no case shall the value returned be greater than the value of the {MB_CUR_MAX} macro.</p>
</blockquote>
<h4><a name="tag_03_855_05"></a>ERRORS</h4>
<blockquote>
<p>No errors are defined.</p>
</blockquote>
<hr>
<div class="box"><em>The following sections are informative.</em></div>
<h4><a name="tag_03_855_06"></a>EXAMPLES</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_855_07"></a>APPLICATION USAGE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_855_08"></a>RATIONALE</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_855_09"></a>FUTURE DIRECTIONS</h4>
<blockquote>
<p>None.</p>
</blockquote>
<h4><a name="tag_03_855_10"></a>SEE ALSO</h4>
<blockquote>
<p><a href="mblen.html"><i>mblen</i>()</a> , <a href="mbtowc.html"><i>mbtowc</i>()</a> , <a href=
"mbstowcs.html"><i>mbstowcs</i>()</a> , <a href="wcstombs.html"><i>wcstombs</i>()</a> , the Base Definitions volume of
IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/stdlib.h.html"><i>&lt;stdlib.h&gt;</i></a></p>
</blockquote>
<h4><a name="tag_03_855_11"></a>CHANGE HISTORY</h4>
<blockquote>
<p>First released in Issue 4. Derived from the ANSI&nbsp;C standard.</p>
</blockquote>
<h4><a name="tag_03_855_12"></a>Issue 6</h4>
<blockquote>
<p>Extensions beyond the ISO&nbsp;C standard are marked.</p>
<p>In the DESCRIPTION, a note about reentrancy and thread-safety is added.</p>
</blockquote>
<div class="box"><em>End of informative text.</em></div>
<hr>
<hr size="2" noshade>
<center><font size="2"><!--footer start-->
UNIX &reg; is a registered Trademark of The Open Group.<br>
POSIX &reg; is a registered Trademark of The IEEE.<br>
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
]</font></center>
<!--footer end-->
<hr size="2" noshade>
</body>
</html>