C++ clocale::localeconv() Function



The std::clocale::localeconv() function in C++, provides access to locale-specific numeric and monetary formatting information. It returns a pointer to a lconv structure containing details such as decimal point character, currency symbols and grouping rules.

This function is used for formatting output according to the users regional settings.

Syntax

Following is the syntax for std::clocale::localeconv() function.

struct lconv* localeconv (void);

Parameters

This function does not accepts any parameter.

Return value

This function returns a pointer to a structure object of the structure type lconv with the corresponding values for the current locale filled in.

Example 1

Let's look at the following example, where we are going to display the decimal point symbol.

#include <iostream>
#include <clocale>
int main() {
   struct lconv * a = std::localeconv();
   std::cout << "Result : " << a -> decimal_point << std::endl;
   return 0;
}

Output

Output of the above code is as follows −

Result : .
cpp_clocale.htm
Advertisements