C Standard Libraries C++

strxfrm()

Declaration

size_t strxfrm(char* cpDest, const char* kcpSrc, size_t qCount);

Description

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

Example

#include <cstdio>
#include <cstring>

int main()
{
    char caSource[] = "XoaX.net";
    char caDest[20];
    // Convert the first four chars of "XoaX.net"
    int iLength = strxfrm(caDest, caSource, 4);
    // Add a null-terminator for printing
    caDest[4] = '\0';
    printf("Conversion: %s\n", caDest);
    printf("Converted bytes: %i\n", iLength);

    return 0;
}

Output

strxfrm() Output
 

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