std::mbrtoc16
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <cuchar> 中定义
|
||
std::size_t mbrtoc16( char16_t* pc16, const char* s, |
(C++11 起) | |
。一个狭窄的多字节字符转换成16位字符表示(通常情况下,UTF-16).
原文:
Converts a narrow multibyte character to 16-bit character representation (typically, UTF-16).
。如果
s
是不是一个空指针,检查n
字节的多字节字符串的开始,指向的字节s
必要去完成下一个多字节字符(包括任何移位序列)的字节数来确定。如果该函数确定下一个多字节字符s
是完整的,有效的,将其转换到对应的16位字符,并将其存储在*pc16(如果pc16
不为null)..原文:
If
s
is not a null pointer, inspects at most n
bytes of the multibyte character string, beginning with the byte pointed to by s
to determine the number of bytes necessary to complete the next multibyte character (including any shift sequences). If the function determines that the next multibyte character in s
is complete and valid, converts it to the corresponding 16-bit character and stores it in *pc16 (if pc16
is not null).。如果在
*s
对应于一个多char16_t序列(如UTF-16)的替代品对多字节字符,然后后的第一次调用这个函数,*ps
是在这样一种方式,在下次调用mbrtoc16
写出来的更新额外的char16_t,而不考虑*s
.原文:
If the multibyte character in
*s
corresponds to a multi-char16_t sequence (e.g. a surrogate pair in UTF-16), then after the first call to this function, *ps
is updated in such a way that the next call to mbrtoc16
will write out the additional char16_t, without considering *s
.。
s
是一个空指针,n
和pc16
将被忽略,并且调用相当于std::mbrtoc16(NULL, "", 1, ps).原文:
If
s
is a null pointer, the values of n
and pc16
are ignored and the call is equivalent to std::mbrtoc16(NULL, "", 1, ps).。如果宽字符是空字符,的转换状态*ps代表的初始移位状态.
原文:
If the wide character produced is the null character, the conversion state *ps represents the initial shift state.
。如果宏__STDC_UTF_16__的定义,使用此功能的16位编码是UTF-16,否则它是实现定义.
原文:
If the macro __STDC_UTF_16__ is defined, the 16-bit encoding used by this function is UTF-16, otherwise it is implementation-defined.
[编辑] 。参数。
pc16 | - | 。所得到的16位的字符将被写入的位置的指针。
原文: pointer to the location where the resulting 16-bit character will be written |
s | - | 。指针的多字节字符串作为输入。
原文: pointer to the multibyte character string used as input |
n | - | 。限制的字节数,可以检查。
原文: limit on the number of bytes in s that can be examined |
ps | - | 。解释的多字节字符串时使用的转换状态对象的指针。
原文: pointer to the conversion state object used when interpreting the multibyte string |
===。 返回值。===
。以下适用:第一。
原文:
The first of the following that applies:
- 。 0如果从
s
(字符转换,并存储在*pc16如果非空)是空字符。原文:0 if the character converted froms
(and stored in *pc16 if non-null) was the null character - 。从[1...n]成功转换的多字节字符的字节数
s
。原文:the number of bytes [1...n] of the multibyte character successfully converted froms
- 。 -3如果下一个char16_t多char16_t字符(例如,一个代理对),现在已经被写入*pc16。在这种情况下,从输入处理无字节.原文:-3 if the next char16_t from a multi-char16_t character (e.g. a surrogate pair) has now been written to *pc16. No bytes are processed from the input in this case.
- 。 -2
n
如果下一个字节构成一个不完整的,但到目前为止,有效的多字节字符。没有被写入*pc16.原文:-2 if the nextn
bytes constitute an incomplete, but so far valid, multibyte character. Nothing is written to *pc16. - 。 -1如果出现编码错误。没有被写入
*pc16
,EILSEQ存储在errno是不确定的值,如果*ps.原文:-1 if encoding error occurs. Nothing is written to*pc16
, the value EILSEQ is stored in errno and the value if *ps is unspecified.
[编辑] 。另请参阅。
(C++11) |
一个16位的宽字符转换成多字节字符串缩小 原文: convert a 16-bit wide character to narrow multibyte string (函数) |
[虚]</div></div>
|
将字符串转换,如从文件读取时,从externT到Internt的 原文: converts a string from externT to internT, such as when reading from file (虚拟保护成员函数of std::codecvt )
|
C documentation for mbrtoc16
|