Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <string.h>
    size_t strxfrm( char *dst,
                    const char *src,
                    size_t n );
    #include <wchar.h>
    size_t wcsxfrm( wchar_t *dst,
                    const wchar_t *src,
                    size_t n );

Description:
    The strxfrm function transforms, for no more than n characters, the
    string pointed to by src to the buffer pointed to by dst.  The
    transformation uses the collating sequence selected by the  setlocale
    function so that two transformed strings will compare identically (using
    the  strncmp function) to a comparison of the original two strings using
    the  strcoll function.  The function will be equivalent to the  strncpy
    function (except there is no padding of the dst argument with null
    characters when the argument src is shorter than n characters) when the
    collating sequence is selected from the "C" locale.

    The wcsxfrm function is a wide-character version of strxfrm that
    operates with wide-character strings.  For wcsxfrm, after the string
    transformation, a call to  wcscmp with the two transformed strings
    yields results identical to those of a call to  wcscoll applied to the
    original two strings.  wcsxfrm and strxfrm behave identically otherwise.

Returns:
    The strxfrm function returns the length of the transformed string.  If
    this length is more than n, the contents of the array pointed to by dst
    are indeterminate.

Example:
    #include <stdio.h>
    #include <string.h>
    #include <locale.h>

    char src[] = { "A sample STRING" };
    char dst[20];

    void main()
      {
        size_t len;

        setlocale( LC_ALL, "C" );
        printf( "%s\n", src );
        len = strxfrm( dst, src, 20 );
        printf( "%s (%u)\n", dst, len );
      }

    produces the following:

    A sample STRING
    A sample STRING (15)

Classification:
    strxfrm is ANSI, wcsxfrm is ANSI

Systems:
     strxfrm - All, Netware

    wcsxfrm - All

See Also:
    setlocale, strcoll

See Also:

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson