How can you check if something read in from a file is a valid integer?
<p>I'm trying something like:</p>

<pre><code>int integer;

cin &gt;&gt; integer;

if(!integer) {//do something}
</code></pre>

<p>but obviously this is a problem if integer = 0.</p>

<p>Are there more efficient methods for checking if something is an integer?</p>
