共用方式為


locale::name

Returns the stored locale name.

string name( ) const;

Return Value

A string giving the name of the locale.

Example

// locale_name.cpp
// compile with: /EHsc
#include <iostream>
#include <string>
#include <locale>

using namespace std;

int main( ) 
{
   locale loc1( "german" );
   locale loc2 = locale::global( loc1 );
   cout << "The name of the previous locale is: " 
        << loc2.name( ) << "." << endl;
   cout << "The name of the current locale is: " 
        << loc1.name( ) << "." << endl;
}
The name of the previous locale is: C.
The name of the current locale is: German_Germany.1252.

Requirements

Header: <locale>

Namespace: std

See Also

Reference

locale Class

Other Resources

locale Members