mbsrtowcs
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <wchar.h> 中定义
|
||
将一个空结束的多字节字符序列,该序列中所描述的
*ps
转换状态,从数组的第一个元素是指向*src
它的宽字符表示开始。 dst
不为空,转换字符被保存在连续的wchar_t数组元素所指向的dst
。以上len
宽字符写入到目标数组.原文:
Converts a null-terminated multibyte character sequence, which begins in the conversion state described by
*ps
, from the array whose first element is pointed to by *src
to its wide character representation. If dst
is not null, converted characters are stored in the successive elements of the wchar_t array pointed to by dst
. No more than len
wide characters are written to the destination array.如果每个多字节字符转换为调用mbrtowc。的停止:转换
原文:
Each multibyte character is converted as if by a call to mbrtowc. The conversion stops if:
- 多字节的空字符被转换和存储。
src
设置为NULL*ps
初始位移状态.原文:The multibyte null character was converted and stored.src
is set to NULL and*ps
represents the initial shift state. - 遇到了无效的多字节字符(根据目前的C语言环境)。
src
被设置为指向的第一个未转化的多字节字符开始.....原文:An invalid multibyte character (according to the current C locale) was encountered.src
is set to point at the beginning of the first unconverted multibyte character.
目录 |
[编辑] 参数
dst | - | 指针的结果将被储存到宽字符数组
原文: pointer to wide character array where the results will be stored |
src | - | null结尾的多字节字符串的第一个元素的指针的指针
原文: pointer to pointer to the first element of a null-terminated multibyte string |
len | - | 指出,DST的宽字符数组中的数
原文: number of wide characters available in the array pointed to by dst |
ps | - | 转换状态对象的指针
原文: pointer to the conversion state object |
[编辑] 返回值
如果成功,则返回的宽字符数,不包括终止L'\0',写入的字符数组..如果dst==NULL,会被写入给定的无限长的宽字符数返回.
原文:
On success, returns the number of wide characters, excluding the terminating L'\0', written to the character array.. If dst==NULL, returns the number of wide characters that would have been written given unlimited length.
在转换错误(如果遇到了无效的多字节字符),返回(size_t)-1,店EILSEQerrno不明确的状态,并留下*ps.
原文:
On conversion error (if invalid multibyte character was encountered), returns (size_t)-1, stores EILSEQ in errno, and leaves *ps in unspecified state.
[编辑] 示例
本章尚未完成 原因:暂无示例 |
[编辑] 另请参阅
下的多字节字符转换为宽字符,给定的状态中 原文: converts the next multibyte character to wide character, given state (函数) | |
宽字符串转换成窄的多字节字符串,给定的状态 原文: converts a wide string to narrow multibyte character string, given state (函数) | |
C++ documentation for mbsrtowcs
|