C++ MFC missing const char* variable
<p>So I have that simple code inside button click method:</p>

<pre><code>std::stringstream ss;
unsigned counter = 0;
while(true)
{
    ss.clear();
    ss &lt;&lt; DEFAULT_USER_CONFIG_NAME &lt;&lt; " " &lt;&lt; ++counter;
    const char* name = ss.str().c_str();
    MessageBox(name);

    /* ... while break condition */
}
</code></pre>

<p>The problem is that messagebox is empty. But it works correctly when I pass text directly:</p>

<pre><code>MessageBox(ss.str().c_str()); // that shows text just fine
</code></pre>

<p>What I found with debugger is that local variable "name" is not created(at least it is not showing in debugger). Any clue why it is working when passed directly and failing otherwise? Also when i casted "name" to CString it returned true on IsEmpty() check.</p>