C Standard Libraries C++

wcsxfrm()

Declaration

size_t wcsxfrm(wchar_t* wpDest,
               const wchar_t* kwpSource,
               size_t uiCount);

Description

This function transforms up to "uiCount" characters of the null-terminated string "kwpSource" into a locale-spcific string based on the current locale, which is placed into the string "wpDest." The function returns the length of the tranformed string, not including the null-terminator.

Example

#include <cwchar>

int main()
{
    wchar_t waSource[] = L"XoaX.net Video Tutorials";
    wchar_t waDest[50];

    // Convert the source string using the current locale
    size_t uiLength = wcsxfrm(waDest, waSource, 30);
    wprintf(L"\"%ws\" converted to \"%ws\"\n",
        waSource, waDest);
    wprintf(L"%d characters were converted\n",
        uiLength);

    // Keep the window open until "Enter" is pressed
    getwchar();
    return 0;
}

Output

wcsxfrm() Output
 

© 2007–2022 XoaX.net LLC. All rights reserved.