title: How to use fscanf() format string
body: <p>I am using fscanf() to read input from a file (I know I should be using fgets() but I'm not allowed) and I can't figure out how to use the format string right.</p>
  
  <p>The input is in the format:
  M 03f8ab8,1</p>
  
  <p>I need the letter, address, and the number to each be saved to a variable. Here is what I've got so far:</p>
  
  <pre class="lang-c prettyprint-override"><code>while(fscanf(file, " %s %s, %d", operation, address, &amp;size) != -1)
  </code></pre>
  
  <p>As written, it puts the letter into the correct var(operation), but adds ,number to the end of the address and then assigns something undefined to the size variable.</p>
  
  <p>It should put each into its own respective variable (and ignore the comma)</p>
  
  <p>How do I set up fscanf() to get this correctly?</p>