list of char* to vector of strings
<p>it looks like when I cout *cp, it only outputs the first letter of the string and after I put them in vector, my output is blank. what am I doing wrong?</p>

<pre><code>//write a program to assign the elements from a list of char* pointers to c-style character strings to a vector of strings
#include &lt;iostream&gt;
#include &lt;cstring&gt;
#include &lt;vector&gt;
#include &lt;list&gt;
#include &lt;string&gt;
using namespace std;
int main ()
{
    list&lt;const char*&gt; clist;
    cout&lt;&lt;"please enter a string"&lt;&lt;endl;
    for(string s; getline(cin,s); )
    {   
        const char* cp=s.c_str();
        clist.push_back(cp);
        cout&lt;&lt;*cp;
    }
    cout&lt;&lt;*clist.begin();
    vector&lt;string&gt; svec;
    svec.assign(clist.begin(),clist.end());
    for(vector&lt;string&gt;::iterator iter=svec.begin(); iter!=svec.end(); ++iter)
        cout&lt;&lt;*iter&lt;&lt;endl;
return 0;
}
</code></pre>
