The wcsrtombs() function converts wide character to multibyte string. This function converts the wide character string represented by *src to corresponding multibyte character string and is stored in the character array pointed to by dest if dest is not null. A maximum of len characters are written to dest.
size_t wcsrtombs( char* dest, const wchar_t** src, size_t len, mbstate_t* ps )
Parameters: The function accepts four mandatory parameters which are described below:
- dest : Pointer to an array of char elements long enough to store a string of max bytes
- src : Pointer to a wide string to be translated
- len : Maximum number of bytes available in dest array
- ps : Pointer to the conversion state object
Return value : The function returns two value as below:
- On success it returns the number of bytes written to dest(not including the eventual terminating null character)
- If some error occurs then -1 is returned and errno is set to EILSEQ.
Below programs illustrate the above function:
Number of multibyte characters = 12 Multibyte characters written = Geekforgeeks
Number of multibyte characters = 14 Multibyte characters written = This website i
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Difference between user defined function and library function in C/C++
- Function Overloading vs Function Overriding in C++
- How to call some function before main() function in C++?
- How to call function within function in C or C++
- Difference between Virtual function and Pure virtual function in C++
- What happens when a virtual function is called inside a non-virtual function in C++
- div() function in C++
- log() function in C++
- exp() function C++
- arc function in C
- fma() function in C++
- scalbn() function in C++
- tolower() function in C
- wmemmove() function in c++
- localtime() function in C++
- toupper() function in C
- difftime() function in C++
- wcscat() function in C++
- wcsncpy() function in C++ with example
- imag() function in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.