| <HTML> |
| <HEAD> |
| <TITLE>Defining Callback Functions</TITLE> |
| <LINK REL=StyleSheet HREF="../rw.css" TYPE="text/css" TITLE="Apache stdcxx Stylesheet"></HEAD> |
| <BODY BGCOLOR=#FFFFFF> |
| <A HREF="37.html"><IMG SRC="images/bprev.gif" WIDTH=20 HEIGHT=21 ALT="Previous file" BORDER=O></A><A HREF="noframes.html"><IMG SRC="images/btop.gif" WIDTH=56 HEIGHT=21 ALT="Top of Document" BORDER=O></A><A HREF="booktoc.html"><IMG SRC="images/btoc.gif" WIDTH=56 HEIGHT=21 ALT="Contents" BORDER=O></A><A HREF="tindex.html"><IMG SRC="images/bindex.gif" WIDTH=56 HEIGHT=21 ALT="Index page" BORDER=O></A><A HREF="37-2.html"><IMG SRC="images/bnext.gif" WIDTH=25 HEIGHT=21 ALT="Next file" BORDER=O></A><DIV CLASS="DOCUMENTNAME"><B>Apache C++ Standard Library User's Guide</B></DIV> |
| <H2>37.1 Defining Callback Functions</H2> |
| <A NAME="idx896"><!></A> |
| <P>The Standard Iostreams use callback functions to allow a program to respond to certain events. This allows programs to easily manage any dynamically allocated memory used by the stream objects. A program registers a callback by providing an ordinary function with an appropriate signature and calling <SAMP>ios_base::register_callback()</SAMP> with a pointer to the function and an index into the stream object's array of words. The registered callback function is then called any time one of the following occurs:</P> |
| <UL> |
| <LI><P CLASS="LIST">Destruction of a stream;<SAMP> std::ios_base::~ios_base()</SAMP> is called.</P></LI> |
| <LI><P CLASS="LIST">Imbuing a locale; <SAMP>std::ios_base::imbue()</SAMP> is called.</P></LI> |
| <LI><P CLASS="LIST">Copying the stream state; <SAMP>std::basic_ios<>::copyfmt()</SAMP> is called.</P></LI> |
| </UL> |
| |
| <BR> |
| <HR> |
| <A HREF="37.html"><IMG SRC="images/bprev.gif" WIDTH=20 HEIGHT=21 ALT="Previous file" BORDER=O></A><A HREF="noframes.html"><IMG SRC="images/btop.gif" WIDTH=56 HEIGHT=21 ALT="Top of Document" BORDER=O></A><A HREF="booktoc.html"><IMG SRC="images/btoc.gif" WIDTH=56 HEIGHT=21 ALT="Contents" BORDER=O></A><A HREF="tindex.html"><IMG SRC="images/bindex.gif" WIDTH=56 HEIGHT=21 ALT="Index page" BORDER=O></A><A HREF="37-2.html"><IMG SRC="images/bnext.gif" WIDTH=20 HEIGHT=21 ALT="Next file" BORDER=O></A> |
| |
| <!-- Google Analytics tracking code --> |
| <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> |
| </script> |
| <script type="text/javascript"> |
| _uacct = "UA-1775151-1"; |
| urchinTracker(); |
| </script> |
| <!-- end of Google Analytics tracking code --> |
| |
| </BODY> |
| </HTML> |