The c16rtomb() is a built-in function in C/C++ which converts 16 bit character representation to a narrow multibyte character representation. It is defined within the uchar.h header file of C++.
size_t c16rtomb(char* s, char16_t c16, mbstate_t* p)
Parameters: The function accepts three mandatory parameters as shown below:
- s: specifies the string where the multibyte character is to be stored.
- c16: specifies the 16 bit character to convert.
- p: specifies the pointer to an mbstate_t object used when interpreting the multibyte string.
Return Value: The function returns two values as shown below:
- On success of the program, the function returns the number of bytes written to the character array pointed to by s.
- On failure, -1 is returned and EILSEQ is stored in err no.
Below programs illustrates the above function.
Note: There is no output in the above program since it is a case of failure.
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.
- 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 user defined function and library function in C/C++
- Function overloading and return type
- Function Pointer in C
- Function overloading and const keyword
- Comparator function of qsort() in C
- Function Overloading and float in C++
- Extra brackets with function names in C/C++
- Function Interposition in C with an example of user defined malloc()
- A C/C++ Function Call Puzzle
- std::tuple, std::pair | Returning multiple values from a function using Tuple and Pair in C++
- Function Overloading in C++
- Power Function in C/C++
- strtoul() function in C/C++
- strtof function in C
- ispunct() function in C
- tmpnam() function in C
- _Noreturn function specifier 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.