How can I parse double from a string?
<p>I have the following code but it only converts strings to double. if the string contains a letter, it causes an error</p>

<pre><code> while (cin &gt;&gt; s){
        const char *c_ptr=s.c_str();
        d = atof(c_ptr);
        v.push_back(d);
    }
</code></pre>

<p>I want to input a string like "a1.2 3 4b"  and have the  vector populated with "1.2 3 4"</p>
