wcstombs() is a builtin function in C++ STL which converts a wide character string to its equivalent multibyte sequence. It is defined within the cstdlib header file of C++.
wcstombs(d, s, n)
- d: It is the parameter which specifies the pointer to a character array at least n bytes long.
- s: It is the parameter which specifies wide-character string to be converted.
- n: It is the parameter which specifies maximum number of wide characters to be converted.
- If the conversion is successful then the function returns the number of bytes (not characters) converted and written to the string, excluding the terminating null character(‘\0’).
- If any error is occured then, -1 is returned.
Number of wide character converted = 13 Multibyte Character String = GeeksforGeeks
Number of wide character converted = 15 Multibyte Character String = 10@Hello World!
- Function Overloading vs Function Overriding 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++
- fma() function in C++
- strtol() function in C++ STL
- iswalpha() function in C++ STL
- towupper() function in C/C++
- fread() function in C++
- exp2() function in C++ STL
- feupdateenv() function in C++
- raise() function in C++
- strtod() function in C/C++
- iswdigit() function in C/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 email@example.com. 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.
Improved By : ManasChhabra2