wctob() function in C++ helps to convert a wide character wc into a single byte, if its if its multibyte character equivalent in the initial shift state is a single byte. Since, the function uses single byte encoding, hence is used for characters from ASCII character set .
int wctob (wint_t wc);
Parameters: The above function accepts a single parameter as described below:
Return Type: The function returns a single byte representation of the wide character wc, if it corresponds to a multibyte character with a length of single byte in initial state. Otherwise, it returns EOF(End Of File).
Below programs illustrate the above function:
wc has 9 characters to be translatedto single-byte characters.
Program 2 :
In Thai UTF-8 locale: 0x61 translated to 0x61 0x3f translated to 0x3f
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
- 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++
- strtoul() function in C/C++
- wcscspn() function in C/C++
- asctime() function in C++
- atanh() function in C++ STL
- vector rbegin() and rend() function in C++ STL
- wcschr() function in C++
- unordered_multimap begin() and end() function in C++ STL
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.