 <p>Given the format <code>$ _( int, int )___ .</code> where <code>_</code> is an arbitrary amount of whitespace use </p> <pre><code>int n = 0; int result = scanf("$ (%d,%d ) .%n", &amp;int1, &amp;int2); if ((result != 2) || (n == 0)) { ; // failed, handle error. } </code></pre> <p>Let's break the scanf() format down</p> <p><code>"$"</code> match a <code>'$'</code><br> <code>" "</code> match 0 to unlimited number of whitespace.<br> <code>"("</code> match <code>'('</code><br> <code>"%d"</code> match any amount of leading whitespace, then look for an <code>int</code>, storing in the corresponding <code>int *</code>.<br> <code>","</code> match <code>','</code><br> <code>")"</code> match <code>')'</code><br> <code>"."</code> match <code>'.'</code><br> <code>"%n"</code> Save the number of <code>char</code> parsed so far into the corresponding <code>int *</code>. Acting on this directive does not affect the <code>scanf()</code> result.</p> <p>Liberal use of <code>%n</code> could be intersperse should more specific scanning be require than suggested in this solution.</p>