Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/locale/localeconv"

From cppreference.com
< cpp‎ | locale
(Example: use {{example template}})
m (Update links.)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
 
{{cpp/title|localeconv}}
 
{{cpp/title|localeconv}}
 
{{cpp/locale/navbar}}
 
{{cpp/locale/navbar}}
{{ddcl list begin}}
+
{{dcl begin}}
{{ddcl list header|clocale}}
+
{{dcl header|clocale}}
{{ddcl list item |
+
{{dcl |
 
std::lconv* localeconv();
 
std::lconv* localeconv();
 
}}
 
}}
{{ddcl list end}}
+
{{dcl end}}
  
The {{tt|localeconv}} function obtains a pointer to a static object of type {{c|std::lconv}}, which represents numeric and monetary formatting rules of the current C locale.
+
The {{tt|localeconv}} function obtains a pointer to a static object of type {{lc|std::lconv}}, which represents numeric and monetary formatting rules of the current C locale.
  
 
===Parameters===
 
===Parameters===
Line 14: Line 14:
  
 
===Return value===
 
===Return value===
Pointer to the current {{c|std::lconv}} object.  
+
Pointer to the current {{lc|std::lconv}} object.  
  
 
===Notes===
 
===Notes===
Line 22: Line 22:
  
 
===Example===
 
===Example===
{{example template | cpp/locale/example1}}
+
{{include| cpp/locale/example1}}
  
 
===See also===
 
===See also===
{{dcl list begin}}
+
{{dsc begin}}
{{dcl list template | cpp/locale/dcl list setlocale}}
+
{{dsc inc | cpp/locale/dsc setlocale}}
{{dcl list template | cpp/locale/dcl list lconv}}
+
{{dsc inc | cpp/locale/dsc lconv}}
{{dcl list see c | c/locale/localeconv}}
+
{{dsc see c | c/locale/localeconv}}
{{dcl list end}}
+
{{dsc end}}
 +
 
 +
[[de:cpp/locale/localeconv]]
 +
[[es:cpp/locale/localeconv]]
 +
[[fr:cpp/locale/localeconv]]
 +
[[it:cpp/locale/localeconv]]
 +
[[ja:cpp/locale/localeconv]]
 +
[[pt:cpp/locale/localeconv]]
 +
[[ru:cpp/locale/localeconv]]
 +
[[zh:cpp/locale/localeconv]]

Latest revision as of 22:09, 31 May 2013

 
 
 
Defined in header <clocale>
std::lconv* localeconv();

The localeconv function obtains a pointer to a static object of type std::lconv, which represents numeric and monetary formatting rules of the current C locale.

Contents

[edit] Parameters

(none)

[edit] Return value

Pointer to the current std::lconv object.

[edit] Notes

Modifying the object references through the returned pointer is undefined behavior.

std::localeconv modifies a static object, calling it from different threads without synchronization is undefined behavior.

[edit] Example

#include <clocale>
#include <iostream>
 
int main()
{
    std::setlocale(LC_ALL, "ja_JP.UTF-8");
    std::lconv* lc = std::localeconv();
    std::cout << "Japanese currency symbol: " << lc->currency_symbol
              << '(' << lc->int_curr_symbol << ")\n";
}

Output:

Japanese currency symbol: ¥(JPY )

[edit] See also

gets and sets the current C locale
(function) [edit]
formatting details, returned by std::localeconv
(class) [edit]
C documentation for localeconv