📄 mblen.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>mblen</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_007_511"> </a>NAME</h4><blockquote>mblen - get number of bytes in a character</blockquote><h4><a name = "tag_000_007_512"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="stdlib.h.html">stdlib.h</a>>int mblen(const char *<i>s</i>, size_t <i>n</i>);</code></pre></blockquote><h4><a name = "tag_000_007_513"> </a>DESCRIPTION</h4><blockquote>If <i>s</i> is not a null pointer,<i>mblen()</i>determines the number of bytes constituting the character pointed to by<i>s</i>.Except that the shift state of<i><a href="mbtowc.html">mbtowc()</a></i>is not affected, it is equivalent to:<pre><code>mbtowc((wchar_t *)0, <i>s</i>, <i>n</i>);</code></pre><p>The implementation will behave as if no function defined in this document calls<i>mblen()</i>.<p>The behaviour of this function is affected bythe LC_CTYPE category of the current locale.For a state-dependent encoding, this function is placed into itsinitial 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 cause the internal state of thefunction to be altered as necessary.A call with<i>s</i>as a null pointer causes this function to return a non-zerovalue if encodings have state dependency, and 0 otherwise.If the implementation employs special bytes to change the shiftstate, these bytes do not produce separate wide-character codes,but are grouped with an adjacent character.Changing the LC_CTYPE category causes the shift state of thisfunction to be indeterminate.</blockquote><h4><a name = "tag_000_007_514"> </a>RETURN VALUE</h4><blockquote>If<i>s</i>is a null pointer,<i>mblen()</i>returns a non-zero or 0 value, if character encodings, respectively, do ordo not have state-dependent encodings. If<i>s</i>is not a null pointer,<i>mblen()</i>either returns 0 (if<i>s</i>points to the null byte), or returns the number of bytesthat constitute the character (if the next<i>n</i>or fewer bytes form a valid character), or returns -1(if they do not form a valid character) and may set<i>errno</i>to indicate the error.In no case will the value returned be greater than<i>n</i>or the value of the MB_CUR_MAX macro.</blockquote><h4><a name = "tag_000_007_515"> </a>ERRORS</h4><blockquote>The<i>mblen()</i>function may fail if:<dl compact><dt>[EILSEQ]<dd>Invalid character sequence is detected.</dl></blockquote><h4><a name = "tag_000_007_516"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_517"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_518"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_519"> </a>SEE ALSO</h4><blockquote><i><a href="mbtowc.html">mbtowc()</a></i>,<i><a href="mbstowcs.html">mbstowcs()</a></i>,<i><a href="wctomb.html">wctomb()</a></i>,<i><a href="wcstombs.html">wcstombs()</a></i>,<i><a href="stdlib.h.html"><stdlib.h></a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -