Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C++
Reference
Libraries Reference
<locale>
Classes
locale Class
Static Functions
 locale::global
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
Standard C++ Library Reference 
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.

The previous locale before the default locale was reset.

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

// 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;
}

Output

The initial locale is: C
The current locale is: German_Germany.1252
The previous locale was: C

Header: <locale>

Reference

locale Class

Other Resources

locale Members

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker