C Standard Libraries C++

wcsncat()

Declaration

wchar_t* wcsncat(wchar_t* wpString,
                 const wchar_t* kwpAppendString,
                 size_t iAppendSize);

Description

This function takes the first "iAppendSize" wide-characters from "kwpAppendString" appends them to "wpString." The function returns a pointer to the concatenated string "wpString."

Example

#include <cwchar>

int main()
{
    wchar_t waString1[] = L"XoaX.net ";
    wchar_t waString2[] = L"Video Tutorials";
    size_t uiAppendSize = 5;

    wprintf(L"Append %u characters of \"%ws\" to \"%ws\"\n",
        uiAppendSize, waString2, waString1);
    // Append 5 characters of string2 to string1
    wcsncat(waString1, waString2, uiAppendSize);
    wprintf(L"The result is \"%ws\"\n", waString1);

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

Output

wcsncat() Output
 

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