title: scanf() variable length specifier
body: <p>How can I use a variable to specify the max number of chars <code>scanf()</code> should read in?</p>
  
  <p>For example using <code>printf()</code> you can use the * like so</p>
  
  <pre><code>#define MAXVAL 5
  printf("Print at maximum MAXVAL chars: %.*s\n", MAXVAL, "myStringHere");
  </code></pre>
  
  <p>This will only print 5 chars, how can I make <code>scanf</code> only read in MAXVAL? MAXVAL must be used as the length specifier. I <strong>cannot</strong> simply do</p>
  
  <pre><code>scanf("%5s", string);
  </code></pre>
  
  <p>Right now I can only think of reading into a large array using <code>scanf</code> then using <code>ssprintf</code> to store the string into my length limited string. Using a length specifier would be so much easier however.</p>