Function strxfrm () in C

The function size_t strxfrm (char * dest, const char * src, size_t n) transforms the first n characters of the src string into the current locale and places them in dest string.

Declaring the function strxfrm () in C

Here is the declaration for strxfrm () in C:

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

Parameters

dest - This is the pointer to the destination array, where the content is to be copied. It can be a null pointer if the parameter for n is 0.

src - This is the string to be converted into the current Locale.

n - The maximum number of characters to be copied to str1.

Returns the value

This function returns the length of the converted string, not including the ending null character.

For example

The following C program illustrates the usage of strxfrm () in C:

 #include #include int main () { char dest [ 20 ]; char src [ 20 ]; int len ; strcpy ( src , "QTM Team" ); len = strxfrm ( dest , src , 20 ); printf ( "Do dai cua chuoi |%s| la: |%d|" , dest , len ); return ( 0 ); } 

Compile and run C program to see the result.

According to Tutorialspoint

Previous article: Function strtok () in C

4 ★ | 1 Vote

May be interested

  • The function printf () in CPhoto of The function printf () in C
    the printf () function in the standard c library sends formatted output to a stdout.
  • time.h in CPhoto of time.h in C
    the file header named time.h in standard library c defines four variable types, two macros and various functions for date and time operations.
  • The function getenv () in CPhoto of The function getenv () in C
    char * getenv (const char * name) function searches the environment string pointed to by the name parameter and returns the value associated with that string.
  • System () function in CPhoto of System () function in C
    the int system (const char * command) function passes the command name or program name specified by the command to the host environment to be executed by the command processor and returned after the command is completed.
  • The function bsearch () in CPhoto of The function bsearch () in C
    void function * bsearch (const void * key, const void * base, nitems, size, int (* compar) (const void *, const void *)) looks for an array of nitems objects, its original member is point to by base, for a member that connects the object pointed to by the key. the size of each array element is determined by size.
  • The qsort () function in CPhoto of The qsort () function in C
    void qsort function (void * base, so-phan-tu, kich-co, int (* compar) (const void *, const void *)) arranges an array.