C++: something is getting sent to the console: how do I, instead, store it to a variable?
<pre><code>string convert_binary_to_hex(string binary_value)
{
    bitset&lt;8&gt; set(binary_value);    
    cout &lt;&lt; hex &lt;&lt; set.to_ulong() &lt;&lt; endl; // this is the output that I want to store to a variable to return
    return "";
}
</code></pre>

<p>I've not really done C before. =D</p>

<p>EDIT:
a user suggested ostringstream:</p>

<pre><code>ostringstream result;
bitset&lt;8&gt; set(binary_value);    
result &lt;&lt; hex &lt;&lt; set.to_ulong() &lt;&lt; endl;
return result.str();
</code></pre>

<p>but it now give this error: </p>

<pre><code>main.cpp:20: error: aggregate ‘std::ostringstream result’ has incomplete type and cannot be defined
</code></pre>

<p>Also, my imports: </p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;bitset&gt;


using namespace std;
</code></pre>
