.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved .TH "MBLEN" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" .\" mblen .SH NAME mblen \- get number of bytes in a character .SH SYNOPSIS .LP \fB#include .br .sp int mblen(const char *\fP\fIs\fP\fB, size_t\fP \fIn\fP\fB); .br \fP .SH DESCRIPTION .LP If \fIs\fP is not a null pointer, \fImblen\fP() shall determine the number of bytes constituting the character pointed to by \fIs\fP. Except that the shift state of \fImbtowc\fP() is not affected, it shall be equivalent to: .sp .RS .nf \fBmbtowc((wchar_t *)0,\fP \fIs\fP\fB,\fP \fIn\fP\fB); \fP .fi .RE .LP The implementation shall behave as if no function defined in this volume of IEEE\ Std\ 1003.1-2001 calls \fImblen\fP(). .LP The behavior of this function is affected by the \fILC_CTYPE\fP 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, \fIs\fP, is a null pointer. Subsequent calls with \fIs\fP as other than a null pointer shall cause the internal state of the function to be altered as necessary. A call with \fIs\fP as a null pointer shall cause this function to return a non-zero value if encodings have state dependency, and 0 otherwise. If the implementation employs special bytes to change the shift state, these bytes shall not produce separate wide-character codes, but shall be grouped with an adjacent character. Changing the \fILC_CTYPE\fP category causes the shift state of this function to be unspecified. .SH RETURN VALUE .LP If \fIs\fP is a null pointer, \fImblen\fP() shall return a non-zero or 0 value, if character encodings, respectively, do or do not have state-dependent encodings. If \fIs\fP is not a null pointer, \fImblen\fP() shall either return 0 (if \fIs\fP points to the null byte), or return the number of bytes that constitute the character (if the next \fIn\fP or fewer bytes form a valid character), or return -1 (if they do not form a valid character) \ and may set \fIerrno\fP to indicate the error. In no case shall the value returned be greater than \fIn\fP or the value of the {MB_CUR_MAX} macro. .SH ERRORS .LP The \fImblen\fP() function may fail if: .TP 7 .B EILSEQ Invalid character sequence is detected. .sp .LP \fIThe following sections are informative.\fP .SH EXAMPLES .LP None. .SH APPLICATION USAGE .LP None. .SH RATIONALE .LP None. .SH FUTURE DIRECTIONS .LP None. .SH SEE ALSO .LP \fImbtowc\fP() , \fImbstowcs\fP() , \fIwctomb\fP() , \fIwcstombs\fP() , the Base Definitions volume of IEEE\ Std\ 1003.1-2001, \fI\fP .SH COPYRIGHT Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .