title: Making fscanf Ignore Optional Parameter
body: <p>I am using fscanf to read a file which has lines like<br>
  Number &lt;-whitespace-> string &lt;-whitespace-> optional_3rd_column  </p>
  
  <p>I wish to extract the number and string out of each column, but ignore the 3rd_column if it exists</p>
  
  <p>Example Data:<br>
  12 foo   something<br>
  03 bar<br>
  24 something   #randomcomment</p>
  
  <p>I would want to extract 12,foo; 03,bar; 24, something while ignoring "something" and "#randomcomment"</p>
  
  <p>I currently have something like</p>
  
  <pre><code>while(scanf("%d %s %*s",&amp;num,&amp;word)&gt;=2)
  { 
  assign stuff 
  }
  </code></pre>
  
  <p>However this does not work with lines with no 3rd column. How can I make it ignore everything after the 2nd string?</p>