C Standard Libraries C++

localeconv()

Declaration

lconv* localeconv();

Description

This function returns a pointer to an lconv variable which describes the current locale settings.

Example

#include <iostream>
#include <clocale>

int main() {
    using namespace std;

    char* cpSettings = setlocale(LC_ALL, "usa");
    lconv* qpLoc = localeconv();
    cout << "currency_symbol    = " << qpLoc->currency_symbol << endl;
    cout << "decimal_point      = " << qpLoc->decimal_point << endl;
    cout << "frac_digits        = " << qpLoc->frac_digits << endl;
    cout << "grouping           = " << qpLoc->grouping << endl;
    cout << "int_curr_symbol    = " << qpLoc->int_curr_symbol << endl;
    cout << "int_frac_digits    = " << qpLoc->int_frac_digits << endl;
    cout << "mon_decimal_point  = " << qpLoc->mon_decimal_point << endl;
    cout << "mon_grouping       = " << qpLoc->mon_grouping << endl;
    cout << "mon_thousands_sep  = " << qpLoc->mon_thousands_sep << endl;
    cout << "mon_thousands_sep  = " << qpLoc->mon_thousands_sep << endl;
    cout << "n_cs_precedes      = " << qpLoc->n_cs_precedes << endl;
    cout << "n_sep_by_space     = " << qpLoc->n_sep_by_space << endl;
    cout << "n_sign_posn        = " << qpLoc->n_sign_posn << endl;
    cout << "negative_sign      = " << qpLoc->negative_sign << endl;
    cout << "p_cs_precedes      = " << qpLoc->p_cs_precedes << endl;
    cout << "p_sep_by_space     = " << qpLoc->p_sep_by_space << endl;
    cout << "p_sign_posn        = " << qpLoc->p_sign_posn << endl;
    cout << "positive_sign      = " << qpLoc->positive_sign << endl;
    cout << "thousands_sep      = " << qpLoc->thousands_sep << endl;
    return 0;
}

Output

localeconv() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.