title: Detecting an empty line in C
body: <p>I'm trying to save input line by line storing it in a string. I need to be able to detect an empty line or a line that consists only of white spaces and print "ignored" if it happens. How do I do that? strlen(str) == 0 doesn't seem to work.   </p>
  
  <pre><code>int getLine(char str[]) {
    int i = 0;
    int c;
    while (i &lt; N - 1 &amp;&amp; (c = getchar()) != EOF &amp;&amp; c != '\n') {
      str[i] = c;
      ++i;
    }
    if (c == EOF) return 0;
    str[i] = '\0';
    return 1;
  }
  </code></pre>