Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
IOstream Library
manipulators
classes:
filebuf
fstream
ifstream
ios
iostream
ios_base
istream
istringstream
ofstream
ostream
ostringstream
streambuf
stringbuf
stringstream
objects:
cerr
cin
clog
cout
types:
fpos
streamoff
streampos
streamsize
ios_base
ios_base::ios_base
ios_base::~ios_base
member classes:
ios_base::failure
ios_base::Init
member functions:
ios_base::flags
ios_base::getloc
ios_base::imbue
ios_base::iword
ios_base::precision
ios_base::pword
ios_base::register_callback
ios_base::setf
ios_base::sync_with_stdio
ios_base::unsetf
ios_base::width
ios_base::xalloc
member types:
ios_base::event
ios_base::event_callback
ios_base::fmtflags
ios_base::iostate
ios_base::openmode
ios_base::seekdir


ios_base::imbue

public member function
locale imbue ( const locale& loc );

Imbue locale

Associates loc to the stream as the new locale object to be used with locale-sensitive operations.

Before that, all callback functions registered through register_callback member with imbue_event as its first parameter are called.

Parameters

loc
locale object to be imbued as the new locale for the stream.

Return value

The locale object associated with the stream before the call.

Example

1
2
3
4
5
6
7
8
9
10
11
12
// imbue example
#include <iostream>
#include <locale>
using namespace std;
  
int main()
{
  locale mylocale("");      // Construct locale object with the user's default preferences
  cout.imbue( mylocale );   // Imbue that locale
  cout << (double) 3.14159 << endl;
  return 0;
}


This code writes a floating point number using the user's prefered locale. For example, in a system configured with a Spanish locale as default, this should write the number using a comma decimal separator:
3,14159

See also