How to change this code?
<pre><code>#include &lt;iostream&gt;
#include &lt;string.h&gt; // for strlen
#include &lt;stdlib.h&gt; // for atoi
#include &lt;sstream&gt;
void expand_combinations(const char *remaining_string, std::ostringstream&amp; i, int remain_depth)
{
    if(remain_depth==0)
    {
        std::cout &lt;&lt; i.str() &lt;&lt; std::endl;
        return;
    }

    for(int k=0; k &lt; strlen(remaining_string); ++k)
    {
        std::ostringstream l;
        l &lt;&lt; i.str();
        l &lt;&lt; remaining_string[k];
        expand_combinations(remaining_string+k+1, l, remain_depth - 1);
    }
    return;
}
int main(int argc, char **argv)
{
    std::ostringstream i;
    if(argc&lt;3) return 1;
    expand_combinations(argv[1], i, atoi(argv[2]));
    return 0;
}
</code></pre>

<p>How can this code be changed so that it doesn't use ostringstream?</p>
