Standard library header <cwchar>
From cppreference.net
此头文件最初作为 <wchar.h> 存在于C标准库中。
此头文件是空终止 宽字符 与 多字节 字符串库的组成部分。 同时提供若干 C风格I/O 功能及 C风格日期 的转换功能。
目录 |
宏
|
实现定义的空指针常量
(宏常量) |
|
|
WEOF
|
用于指示错误的
std::wint_t
类型非字符值
(宏常量) |
|
WCHAR_MIN
|
wchar_t
的最小有效值
(宏常量) |
|
WCHAR_MAX
|
wchar_t
的最大有效值
(宏常量) |
类型
|
用于迭代多字节字符串所需的转换状态信息
(类) |
|
|
由
sizeof
运算符返回的无符号整数类型
(类型定义) |
|
wint_t
|
可容纳任何有效宽字符及至少一个额外值的整数类型 |
|
日历时间类型
(类) |
函数
字符串操作 |
|
|
将一个宽字符串复制到另一个宽字符串
(函数) |
|
|
将指定数量的宽字符从一个字符串复制到另一个字符串
(函数) |
|
|
将一个宽字符串的副本追加到另一个宽字符串
(函数) |
|
|
将指定数量的宽字符从一个宽字符串追加到另一个宽字符串
(函数) |
|
转换宽字符串,使得
wcscmp
能产生与
wcscoll
相同的结果
(函数) |
|
字符串检查 |
|
|
返回宽字符串的长度
(函数) |
|
|
比较两个宽字符串
(函数) |
|
|
比较两个宽字符串中的指定数量字符
(函数) |
|
|
根据当前区域设置比较两个宽字符串
(函数) |
|
|
在宽字符串中查找宽字符的首次出现
(函数) |
|
|
在宽字符串中查找宽字符的最后一次出现
(函数) |
|
|
返回仅包含另一宽字符串中宽字符的最大初始段长度
(函数) |
|
|
返回仅包含在另一个宽字符串中
未出现 的宽字符的最大起始段长度 (函数) |
|
|
在宽字符串中查找另一个宽字符串中任意宽字符的首次出现位置
(函数) |
|
|
在另一个宽字符串中查找第一个出现的宽字符串
(函数) |
|
|
在宽字符串中查找下一个令牌
(函数) |
|
宽字符数组操作 |
|
|
在两个不重叠的数组之间复制指定数量的宽字符
(函数) |
|
|
在两个可能重叠的数组之间复制指定数量的宽字符
(函数) |
|
|
比较两个数组中的指定数量宽字符
(函数) |
|
|
在宽字符数组中查找宽字符的首次出现
(函数) |
|
|
将给定的宽字符复制到宽字符数组的每个位置
(函数) |
|
多字节/宽字符转换 |
|
|
检查
std::mbstate_t
对象是否表示初始移位状态
(函数) |
|
|
将单字节窄字符(若可能)扩展为宽字符
(函数) |
|
|
若可能则将宽字符窄化为单字节窄字符
(函数) |
|
|
返回下一个多字节字符的字节数(给定状态)
(函数) |
|
|
根据给定状态将下一个多字节字符转换为宽字符
(函数) |
|
|
根据给定状态将宽字符转换为其多字节表示形式
(函数) |
|
|
将窄多字节字符串转换为宽字符串,给定状态
(函数) |
|
|
将宽字符串转换为窄多字节字符串,给定状态
(函数) |
|
输入/输出 |
|
|
从文件流获取宽字符
(函数) |
|
|
从文件流获取宽字符串
(函数) |
|
|
向文件流写入宽字符
(函数) |
|
|
将宽字符串写入文件流
(函数) |
|
|
从
stdin
读取宽字符
(函数) |
|
|
向
stdout
写入宽字符
(函数) |
|
|
将宽字符放回文件流
(函数) |
|
|
切换文件流在宽字符I/O与窄字符I/O之间的模式
(函数) |
|
|
从
stdin
、文件流或缓冲区读取格式化的宽字符输入
(函数) |
|
|
(C++11)
(C++11)
(C++11)
|
从
stdin
、文件流或缓冲区读取格式化宽字符输入
使用可变参数列表 (函数) |
|
将格式化宽字符输出打印到
stdout
、文件流或缓冲区
(函数) |
|
|
使用可变参数列表将格式化宽字符输出打印到
stdout
、文件流
或缓冲区 (函数) |
|
字符串转换 |
|
|
将
std::tm
对象转换为自定义宽字符串文本表示
(函数) |
|
|
将宽字符串转换为整数值
(函数) |
|
|
将宽字符串转换为无符号整数值
(函数) |
|
|
将宽字符串转换为浮点数值
(函数) |
|
注释
- NULL 还在以下头文件中定义:
- std::size_t 还在以下头文件中定义:
-
std::wint_t还在以下头文件中定义: - std::tm 还在以下头文件中定义:
概要
namespace std { using size_t = /* 查看描述 */; // freestanding using mbstate_t = /* 查看描述 */; // freestanding using wint_t = /* 查看描述 */; // freestanding struct tm; int fwprintf(FILE* stream, const wchar_t* format, ...); int fwscanf(FILE* stream, const wchar_t* format, ...); int swprintf(wchar_t* s, size_t n, const wchar_t* format, ...); int swscanf(const wchar_t* s, const wchar_t* format, ...); int vfwprintf(FILE* stream, const wchar_t* format, va_list arg); int vfwscanf(FILE* stream, const wchar_t* format, va_list arg); int vswprintf(wchar_t* s, size_t n, const wchar_t* format, va_list arg); int vswscanf(const wchar_t* s, const wchar_t* format, va_list arg); int vwprintf(const wchar_t* format, va_list arg); int vwscanf(const wchar_t* format, va_list arg); int wprintf(const wchar_t* format, ...); int wscanf(const wchar_t* format, ...); wint_t fgetwc(FILE* stream); wchar_t* fgetws(wchar_t* s, int n, FILE* stream); wint_t fputwc(wchar_t c, FILE* stream); int fputws(const wchar_t* s, FILE* stream); int fwide(FILE* stream, int mode); wint_t getwc(FILE* stream); wint_t getwchar(); wint_t putwc(wchar_t c, FILE* stream); wint_t putwchar(wchar_t c); wint_t ungetwc(wint_t c, FILE* stream); double wcstod(const wchar_t* nptr, wchar_t** endptr); float wcstof(const wchar_t* nptr, wchar_t** endptr); long double wcstold(const wchar_t* nptr, wchar_t** endptr); long int wcstol(const wchar_t* nptr, wchar_t** endptr, int base); long long int wcstoll(const wchar_t* nptr, wchar_t** endptr, int base); unsigned long int wcstoul(const wchar_t* nptr, wchar_t** endptr, int base); unsigned long long int wcstoull(const wchar_t* nptr, wchar_t** endptr, int base); wchar_t* wcscpy(wchar_t* s1, const wchar_t* s2); // freestanding wchar_t* wcsncpy(wchar_t* s1, const wchar_t* s2, size_t n); // freestanding wchar_t* wmemcpy(wchar_t* s1, const wchar_t* s2, size_t n); // freestanding wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n); // freestanding wchar_t* wcscat(wchar_t* s1, const wchar_t* s2); // freestanding wchar_t* wcsncat(wchar_t* s1, const wchar_t* s2, size_t n); // freestanding int wcscmp(const wchar_t* s1, const wchar_t* s2); // freestanding int wcscoll(const wchar_t* s1, const wchar_t* s2); int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n); // freestanding size_t wcsxfrm(wchar_t* s1, const wchar_t* s2, size_t n); int wmemcmp(const wchar_t* s1, const wchar_t* s2, size_t n); // freestanding const wchar_t* wcschr(const wchar_t* s, wchar_t c); // freestanding wchar_t* wcschr(wchar_t* s, wchar_t c); // freestanding size_t wcscspn(const wchar_t* s1, const wchar_t* s2); // freestanding const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2); // freestanding wchar_t* wcspbrk(wchar_t* s1, const wchar_t* s2); // freestanding const wchar_t* wcsrchr(const wchar_t* s, wchar_t c); // freestanding wchar_t* wcsrchr(wchar_t* s, wchar_t c); // freestanding size_t wcsspn(const wchar_t* s1, const wchar_t* s2); // freestanding const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2); // freestanding wchar_t* wcsstr(wchar_t* s1, const wchar_t* s2); // freestanding wchar_t* wcstok(wchar_t* s1, const wchar_t* s2, wchar_t** ptr); // freestanding const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n); // freestanding wchar_t* wmemchr(wchar_t* s, wchar_t c, size_t n); // freestanding size_t wcslen(const wchar_t* s); // freestanding wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n); // freestanding size_t wcsftime(wchar_t* s, size_t maxsize, const wchar_t* format, const tm* timeptr); wint_t btowc(int c); int wctob(wint_t c); // 多字节/宽字符串与字符转换函数 int mbsinit(const mbstate_t* ps); size_t mbrlen(const char* s, size_t n, mbstate_t* ps); size_t mbrtowc(wchar_t* pwc, const char* s, size_t n, mbstate_t* ps); size_t wcrtomb(char* s, wchar_t wc, mbstate_t* ps); size_t mbsrtowcs(wchar_t* dst, const char** src, size_t len, mbstate_t* ps); size_t wcsrtombs(char* dst, const wchar_t** src, size_t len, mbstate_t* ps); } #define NULL /* 见描述 */ // freestanding #define WCHAR_MAX /* 见描述 */ // freestanding #define WCHAR_MIN /* 见描述 */ // freestanding #define WEOF /* 见描述 */ // freestanding
缺陷报告
以下行为变更缺陷报告被追溯应用于先前发布的 C++ 标准。
| DR | 适用版本 | 发布行为 | 正确行为 |
|---|---|---|---|
| LWG 345 | C++98 |
std::tm
未在
<cwchar>
中提供
|
已提供 |