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