Jump to: navigation, search



The strxfrm() function transforms the string pointed to by src and places the resulting string into the array pointed to by dest. The transformation is such that if the strcmp() function is applied to two transformed strings, it returns a value greater than, equal to, or less than zero, corresponding to the result of the strcoll() function applied to the same two original strings. No more than n characters are placed into the resulting array pointed to by dest, including the terminating null character. If n is zero, dest is permitted to be a null pointer. If copying takes place between objects that overlap, the behavior is undefined.

Return value

The strxfrm() function returns the length of the transformed string (not including the terminating null character). If the value returned is n or more, the contents of the array pointed to by dest are indeterminate.


Declared in string.h

The C89 prototype is:

size_t strxfrm(char *dest, const char *src, size_t n);

The C99 prototype adds restrict-qualifiers:

size_t strxfrm(char * restrict dest, const char * restrict src, size_t n);


In standard C, this can be implemented as (adjust prototype for C99):

#include <string.h> /* strlen() strcpy() size_t */
size_t strxfrm(char *dest, const char *src, size_t n)
    /* This implementation does not know about any locale but "C"... */
    size_t n2=strlen(src);
    return n2;

Compilable unit, portable C89 in implementation namespace; public domain; past reviewers: none; current reviews: none


The C Standard, (C99 numbering)

Personal tools
Personal tools
not logged in