Rogue Wave banner
Previous fileTop of DocumentContentsNext file

16.2 An Example

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

//1The function show_event will now be 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 will be called in the opposite order of registration.

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



Previous fileTop of DocumentContentsNext file

©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.


OEM Release, June 1998