Condividi tramite


locale::global

Resets the default local for the program.

static locale global(
    const locale& _Loc
);

Parameters

  • _Loc
    The locale to be used as the default locale by the program.

Return Value

The previous locale before the default locale was reset.

Remarks

At program startup, the global locale is the same as the classic locale.

Example

// locale_global.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <tchar.h>
using namespace std;

int main( )
{
   locale loc ( "German_germany" );
   locale loc1;
   cout << "The initial locale is: " << loc1.name( ) << endl;
   locale loc2 = locale::global ( loc );
   locale loc3;
   cout << "The current locale is: " << loc3.name( ) << endl;
   cout << "The previous locale was: " << loc2.name( ) << endl;
}
The initial locale is: C
The current locale is: German_Germany.1252
The previous locale was: C

Requirements

Header: <locale>

Namespace: std

See Also

Reference

locale Class

Other Resources

locale Members