Function to validate a value returns true when it calls 1 digit, but when its 2 or more it returns false even when it's true
<p>So I have been at this problem for a few hours now and I have no idea what's wrong. This function returns true or false if the int that is called is a valid one. When I call a valid number that is 1 digit long so "0", or "1" it returns true. But when I call a number that is bigger than 1 digit like "83" or "955" which should return true, it always returns false even when it should return true! </p>

<p>My validator function:</p>

<pre><code>int isRegistered(FILE* file, int area) {

int areaDigit = 0;
int check = 0;

while(fscanf(file, "%d %*[^ ] %*[^\n]", &amp;areaDigit) != EOF)
{
     if (area == areaDigit)
       check = 1;
}

return check;
</code></pre>

<p>and the code that calls that function:</p>

<pre><code>  for ( i = 0; i &lt; areaCounter; i++)
    {
    cout &lt;&lt; areaInt &lt;&lt; endl;
    areaCheck = isRegistered(file, areaInt);

    if (areaCheck != 1)
        areaInt = areaInt * 10 + areaIntA[i+1];
    }
</code></pre>

<p>If the value of areaIntA[3] = 955, then the loop calls, 9, then 95, then 955 until it no longer has digits to call. 955 SHOULD return true because that value is true but for some reason it is returning false.</p>

<p>When I call '0' or '1' which are true, it returns true but for anything larger than 1 digit it always returns false. Anyone know why?</p>
