std::ios_base::getloc

From cppreference.com
< cpp‎ | io‎ | ios base
 
 
Input/output library
I/O manipulators
C-style I/O
Buffers
(deprecated in C++98)
Streams
Abstractions
File I/O
String I/O
Array I/O
(deprecated in C++98)
(deprecated in C++98)
(deprecated in C++98)
Synchronized Output
Types
Error category interface
(C++11)
 
 
std::locale getloc() const;

Returns the current locale associated with the stream.

Parameters

(none)

Return value

the locale object associated with the stream.

Example

#include <iostream>
#include <ctime>
#include <iomanip>
#include <codecvt>
 
int main()
{
    std::wbuffer_convert<std::codecvt_utf8<wchar_t>> conv(std::cout.rdbuf());
    std::wostream out(&conv);
 
    out.imbue(std::locale(out.getloc(),
                          new std::time_put_byname<wchar_t>("ja_JP")));
 
    std::time_t t = std::time(NULL);
    out << std::put_time(std::localtime(&t), L"%A %c") << '\n';
}

Output:

土曜日 2013年09月14日 11時31分15秒

See also

sets locale
(public member function)