clocale: This header file contains declaration of a set of functions and a type for internationalization support tasks. It supports date format or country specific currency symbols.
For example, date/time formatting, monetary formatting and many more.
Methods in clocale header:
- localeconv(): This function returns an object which represents numeric and monetary formatting rules of the current C locale. Its corresponding header file is . The “c” locale is the minimal locale. It is a locale which has the same settings across all the compilers, so the result is predictable anyway. By default used on all C programs.
Parameters: This method has no parameters.
Return value: This function returns a pointer to a static object that contains numeric and monetary formatting rules of the current C locale.
* lc =
- setlocale(): The setlocale() function installs the specified system locale. Moreover, it sets the locale information for the current C program. It can also be used to query the current C locale. It has some parameters namely,
- LC_ALL -> Selects all the C locale
- LC_NUMERIC -> Selects numeric formatting category
- LC_MONETARY -> Monetary formatting category
- LC_CTYPE -> Character classification category
- LC_TIME -> Time formatting category
int setlocale(int category, const char* locale);
Return value: It returns a pointer to the string identifying the C locale after applying the changes. Otherwise, it returns a NULL pointer.
cout << s <<
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.
- accumulate() and partial_sum() in C++ STL : numeric header
- numeric header in C++ STL | Set 2 (adjacent_difference(), inner_product() and iota())
- What’s difference between header files "stdio.h" and "stdlib.h" ?
- Header files in C/C++ with Examples
- Understanding ShellExecute function and it's application to open a list of URLs present in a file using C++ code
- Set position with seekg() in C++ language file handling
- How to iterate through a Vector without using Iterators in C++
- std::cerr | Error Stream Object in C++ with Examples
- <cfloat> float.h in C/C++ with Examples
- Sets of pairs in C++
- Thread joinable() function in C++
- map rbegin() function in C++ STL
- is_reference Template in C++
- map rend() 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.