size_t mbsrtowcs(wchar_t* wpConverted,
const char** kcppMString,
size_t qCharCount,
mbstate_t qMBState);#include <iostream>
#include <cwchar>
int main()
{
using namespace std;
const char* kcpName = "XoaX.txt";
wchar_t waWideString[10];
// Convert the string kcpName
size_t qReturn = mbsrtowcs(waWideString, &kcpName, 9, NULL);
// 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;
}
© 20072026 XoaX.net LLC. All rights reserved.