std::c16rtomb
来自cppreference.com
![]() |
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <cuchar> 中定义
|
||
std::size_t c16rtomb( char* s, char16_t c16, std::mbstate_t* ps ); |
(C++11 起) | |
。将一个16位的多字节字符的宽字符来缩小.
原文:
Converts a 16-bit wide character to narrow multibyte character.
。
s
是不是一个空指针,函数的数量决定了需要存储的字节的多字节字符表示c16
(包括任何移位序列),和存储多字节字符表示的字符数组,该数组的第一个元素是指向s
。通过此功能可以写在最MB_CUR_MAX字节.原文:
If
s
is not a null pointer, the function determines the number of bytes necessary to store the multibyte character representation of c16
(including any shift sequences), and stores the multibyte character representation in the character array whose first element is pointed to by s
. At most MB_CUR_MAX bytes can be written by this function.。
s
是一个空指针,调用等效std::c16rtomb(buf, u'\0', ps)一些内部缓冲区buf
.原文:
If
s
is a null pointer, the call is equivalent to std::c16rtomb(buf, u'\0', ps) for some internal buffer buf
.。
如果C16是空宽字符u'\0'的,一个空字节存储,在此之前通过必要的任何变化序列,恢复初始移位状态的更新和转换状态参数*ps代表初始位移状态的.
原文:
If c16 is the null wide character u'\0', a null byte is stored, preceded by any shift sequence necessary to restore the initial shift state and the conversion state parameter *ps is updated to represent the initial shift state.
。如果宏__STDC_UTF_16__的定义,使用此功能的16位编码是UTF-16,否则它是实现定义的。在任何情况下,使用此功能指定多字节编码由目前活跃的C语言环境.
原文:
If the macro __STDC_UTF_16__ is defined, the 16-bit encoding used by this function is UTF-16, otherwise it is implementation-defined. In any case, the multibyte encoding used by this function is specified by the currently active C locale.
[编辑] 。参数。
s | - | 。窄字符数组的多字节字符将被存储的指针。
原文: pointer to narrow character array where the multibyte character will be stored |
c16 | - | 。 16位字符的转换。
|
ps | - | 。解释的多字节字符串时使用的转换状态对象的指针。
原文: pointer to the conversion state object used when interpreting the multibyte string |
===。 返回值。===
。如果成功,则返回的字节数(包括任何移位序列)写入的字符数组,该数组的第一个元素是指向
s
。此值可为0,例如当处理char16_t中的替代品对.原文:
On success, returns the number of bytes (including any shift sequences) written to the character array whose first element is pointed to by
s
. This value may be 0, e.g. when processing the first char16_t in a surrogate pair.。失败(如果c16是不是一个有效的16位字符),返回-1,店EILSEQerrno不明确的状态,并留下*ps.
原文:
On failure (if c16 is not a valid 16-bit character), returns -1, stores EILSEQ in errno, and leaves *ps in unspecified state.
[编辑] 。另请参阅。
(C++11) |
产生下一个16位宽的字符从一个狭窄的多字节字符串 原文: generate the next 16-bit wide character from a narrow multibyte string (函数) |
[虚]</div></div>
|
转换成一个字符串,如写入文件时,从Internt的externT 原文: converts a string from internT to externT, such as when writing to file (虚拟保护成员函数of std::codecvt )
|
C documentation for c16rtomb
|