title: Can I use scanf to capture a directive with a width specified by a variable?
body: <p>I have the following code:</p>
  
  <pre><code>scanf(" %Xs %Ys", buf1, buf2);
  </code></pre>
  
  <p>Where X and Y should be integers. The problem is that the values for X and Y are compile-time constants, and even if I wanted to hard-code the values into the format string, I can't, because I don't know the values. In printf, you can send a width variable along with the arguments with "%*s". Is there anything analogous for scanf?</p>
  
  <p>EDIT: To clarify, constants are known at <em>compile</em> time, but not at <em>coding</em> time, and not by me at all.  They may vary by platform or implementation, and they may change after I'm done. Even did they not, I still wouldn't want to have buffer sizes duplicated in format strings, ready to segfault the minute I forget to keep them synchronized.</p>