Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::ios_base::getloc(3)      C++ Standard Libary     std::ios_base::getloc(3)

NAME
       std::ios_base::getloc - std::ios_base::getloc

Synopsis
	  std::locale getloc() const;

	  Returns the current locale associated	with the stream.

Parameters
	  (none)

Return value
	  The locale object associated with the	stream.

Example
       // Run this code

	#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_by-
       name<wchar_t>("ja_JP")));

	    std::time_t	t = std::time(nullptr);
	    out	<< std::put_time(std::localtime(&t), L"%A %c") << '\n';
	}

Possible output:
	 20130914 113115

See also
	  imbue	sets locale
		(public	member function)

http://cppreference.com		  2022.07.31	      std::ios_base::getloc(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::ios_base::getloc&sektion=3&manpath=FreeBSD+Ports+15.0>

home | help