Namespaces
Variants
Actions

std::basic_ios<CharT,Traits>::imbue

From cppreference.com
< cpp‎ | io‎ | basic ios
 
C++
 
Input/output library
 
std::basic_ios
std::locale imbue( const std::locale& loc );

Replaces the current locale. Effectively calls ios_base::imbue(loc) and if there is an associated stream buffer (rdbuf() != 0), then calls rdbuf()->pubimbue(loc).

Contents

[edit] Parameters

loc - the new locale

[edit] Return value

The previous locale, as returned by ios_base::imbue(loc).

[edit] Exceptions

May throw implementation-defined exceptions.

[edit] Example

#include <iostream>
#include <locale>
#include <sstream>
 
int main()
{
    std::istringstream iss;
    iss.imbue(std::locale("en_US.UTF8");
 
    std::cout << "Current locale: " << iss.getloc().name() << '\n';
 
    iss.imbue(std::locale();
    std::cout << "Global locale : " << iss.getloc().name() << '\n';
}

Output:

Current locale: en_US.UTF8
Global locale : C

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant