std::wctob
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <cwchar> 中定义
|
||
int wctob( std::wint_t c ); |
||
缩小了相当于在初始位移状态,如果它的多字节字符的宽字符
c
是一个单字节.原文:
Narrows a wide character
c
if its multibyte character equivalent in the initial shift state is a single byte.这通常是可能的ASCII字符集的字符,因为大多数的多字节编码(如UTF-8)使用单字节编码那些个字符。
原文:
This is typically possible for the characters from the ASCII character set, since most multibyte encodings (such as UTF-8) use single bytes to encode those characters.
[编辑] 。参数。
c | - | 宽字符来缩小。
|
===。 返回值。===
。EOF如果
c
并不代表多字节字符长度1在初始移位状态原文:
EOF if
c
does not represent a multibyte character with length 1 in initial shift state.,否则,
c
unsigned char转换为int原文:
Otherwise, the single-byte representation of
c
as unsigned char converted to int[编辑] 。为例。
#include <cwchar> #include <cstdio> #include <clocale> int main() { std::setlocale(LC_ALL, ""); std::printf("narrow: %c\nnarrowed from wide: %c\n", 'a', std::wctob(L'a')); }
输出:
narrow: a narrowed from wide: a
[编辑] 。另请参阅。
扩大一个窄字符的单字节宽字符,如果可能的话 原文: widens a single-byte narrow character to wide character, if possible (函数) | |
[虚]</div></div>
|
将一个或多个字符从 charT char 原文: converts a character or characters from charT to char (虚拟保护成员函数of std::ctype )
|
C documentation for wctob
|