名前空間
変種
操作

std::ios_base::getloc

提供: cppreference.com
< cpp‎ | io‎ | ios base
 
 
 
 
std::locale getloc()const;

ストリームに紐付けられている現在のロケールを返します。

目次

[編集]引数

(なし)

[編集]戻り値

ストリームに紐付けられているロケールオブジェクト。

[編集]

#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';}

出力:

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

[編集]関連項目

ロケールを設定します
(パブリックメンバ関数)[edit]
close