int mbsinit(const mbstate_t* kqpMBState);
#include <iostream>
#include <cwchar>
int main()
{
using namespace std;
const char* kcpName = "XoaX.txt";
wchar_t waWideString[10];
mbstate_t qState;
// Convert the string kcpName
size_t qReturn = mbsrtowcs(waWideString, &kcpName, 9, &qState);
// Check whether the shift state is in the initial state
if (0 == mbsinit(&qState)) {
cout << "Not Initial Shift State" << endl;
} else {
cout << "Initial Shift State" << endl;
}
// Check whether the call was successful.
if (qReturn < 0) {
cout << "Error!" << endl;
} else {
cout << "Conversion length = " << qReturn << endl;
wcout << "Converted wide string = " << waWideString << endl;
}
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.