Namespaces
Variants
Views
Actions

std::localeconv

From cppreference.com
< cpp‎ | locale
Revision as of 19:42, 2 November 2012 by P12bot (Talk | contribs)

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <clocale>
</td>

<td></td> <td></td> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td class="t-dcl-nopad">
std::lconv* localeconv();
</td>

<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end

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

Parameters

(none)

Return value

Pointer to the current std::lconv object.

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.

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 )

See also

Template:cpp/locale/dcl list setlocaleTemplate:cpp/locale/dcl list lconv
C documentation for localeconv