How to read from stdin int using c++ skipping "," and "Space" till "\n" : <p>I want to read integers from STDIN, 
1,2,3,4</p>

<pre><code>vector&lt;int&gt; r;
cin &gt;&gt; is;
stringstream iss(is);
int n;
while(iss &gt;&gt; n)
{
    r.push_back(n);
}
</code></pre>

<p>but stops reading after "," is there a way other than splitting and directly read Integers only.</p>
