Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

16.2 An Example

A program can register a callback function on a particular stream as follows:

//1The function show_event is now called with either ios_base::erase_event, ios_base::imbue_event, or ios_base::copyfmt_event as the first argument, depending on whether the destruction of the stream, the imbuing of a new locale, or a call to cpyfmt initiated the callback.
//2This causes show_event to be called. The first argument is ios_base::imbue_event; the second argument is a reference to the stream where the event occurred, which is s in this case; and the third argument is always the index provided in the call to register_callback, which is 0 in this case.

If more than one function is registered, functions are called in the opposite order of registration.

Please refer to Section 5.9.2 for an example using callback functions with a user-defined stream inserter.



Previous fileTop of DocumentContentsIndexNext file

OEM Edition, OEM Edition, ©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.