📅  最后修改于: 2020-09-25 09:48:57             🧑  作者: Mango
wcrtomb()在
size_t wcrtomb( char* s, wchar_t wc, mbstate_t* ps );
wcrtomb() 函数将wc
表示的宽字符转换为窄的多字节字符 ,并存储在s
指向的地址中。
#include
#include
#include
using namespace std;
int main()
{
setlocale(LC_ALL, "en_US.utf8");
wchar_t str[] = L"u\u00c6\u00f5\u01b5";
char s[16];
int retVal;
mbstate_t ps = mbstate_t();
for (int i=0; i
运行该程序时,输出为:
Size of u is 1 bytes
Size of Æ is 2 bytes
Size of õ is 2 bytes
Size of Ƶ is 2 bytes