title: How do I test file input for int?
body: <p>I have a program that reads integers from a file and assigns them to certain variables. I have this block of code below to error check the information that is coming from the file. If the information is not a positive integer, the if statement is supposed to catch it and reset the variable and io stream.</p>
  <pre><code>int quantity;
  input &gt;&gt; quantity;
  if(input.fail() || (quantity &lt; 0)){
     quantity = 0; 
     input.clear();
     input.ignore(200, ' ');
  }
  </code></pre>
  <p>However, if the information is a double, then it doesn't enter this block of code and the rest of my program stops working properly. How do I get my program to enter the if statement when a double shows up in my file?</p>