title: Get scanf to quit when it reads a newline?
body: <p>If I input <code>5 5</code> at the terminal, press enter, and press enter again, I want to exit out of the loop.</p>
  
  <pre><code>int readCoefficents(double complex *c){
      int i = 0;
      double real;
      double img;
      while(scanf("%f %f", &amp;real, &amp;img) == 2)
          c[i++] = real + img * I;
  
  
      c[i++] = 1 + 0*I; // most significant coefficient is assumed to be 1
      return i;
  }
  </code></pre>
  
  <p>Obviously, that code isn't doing the job for me (and yes, I know there is a buffer overflow waiting to happen). </p>
  
  <p><code>scanf</code> won't quit unless I type in a letter (or some non-numeric, not whitespace string). How do I get scanf to quit after reading an empty line?</p>