 <p>A swift google came up with this example which may be of use. I offer no guarantees, except that it compiles and runs :-)</p> <pre><code>#include &lt;streambuf&gt; #include &lt;ostream&gt; template &lt;class cT, class traits = std::char_traits&lt;cT&gt; &gt; class basic_nullbuf: public std::basic_streambuf&lt;cT, traits&gt; { typename traits::int_type overflow(typename traits::int_type c) { return traits::not_eof(c); // indicate success } }; template &lt;class cT, class traits = std::char_traits&lt;cT&gt; &gt; class basic_onullstream: public std::basic_ostream&lt;cT, traits&gt; { public: basic_onullstream(): std::basic_ios&lt;cT, traits&gt;(&amp;m_sbuf), std::basic_ostream&lt;cT, traits&gt;(&amp;m_sbuf) { init(&amp;m_sbuf); } private: basic_nullbuf&lt;cT, traits&gt; m_sbuf; }; typedef basic_onullstream&lt;char&gt; onullstream; typedef basic_onullstream&lt;wchar_t&gt; wonullstream; int main() { onullstream os; os &lt;&lt; 666; } </code></pre>