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!
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- 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++
- log() function in C++
- exp() function C++
- fma() function in C++
- div() function in C++
- fegetexceptflag() function in C/C++
- fegetenv() function in C/C++
- wctrans() function in C/C++
- wmemcpy() function in C/C++
- vswprintf() function in C/C++
- wcsncmp() function in C/C++
- wcsrtombs() function in C/C++
- wcstod() function in C/C++
- wcsncat() function in C/C++
- wcstol() 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 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.
Improved By : ManasChhabra2