title: How to do conditional parsing with fscanf?
body: <p>I have some lines I want to parse from a text file. Some lines start with <code>x</code> and continue with several <code>y:z</code> and others are composed completely of several <code>y:z</code>s, where <code>x,y,z</code> are numbers. I tried following code, but it does not work. The first line also reads in the <code>y</code> in <code>y:z</code>. </p>
  
  <pre><code>...
  if (fscanf(stream,"%d ",&amp;x))
  if else (fscanf(stream,"%d:%g",&amp;y,&amp;z))
  ...
  </code></pre>
  
  <p>Is there a way to tell scanf to only read a character if it is followed by a space?</p>