User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:string.h:strxfrm

strxfrm

#include <stdlib.h>
size_t strxfrm(char *str1, const char *str2, size_t n);

description of strxfrm

The function strxfrm () transforms a null-terminated C string according to local settings. Thus the string can be safely compared using strcmp () with another. The transformed string is stored in a new string.

strxfrm C Sourcecode Example

/* 
 * strxfrm example code
 * http://code-reference.com/c/string.h/strxfrm
 */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
 
int main(void)
 {
    char *target, *dst, *source;
    int length;
 
    source  = "the answer: life the universe & everything";
    dst = (char *) calloc(80, sizeof(char));
    length = strxfrm(target, source, 80);
    printf("%s has the length %d\n", target, length);
    return 0;
}

output of strxfrm c example

  the answer: life the universe & everything has the length 42

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/string.h/strxfrm.txt · Last modified: 2024/02/16 01:06 (external edit)

Impressum Datenschutz