title: C read lines from stdin ending by pressing Enter
body: <p>I'm writing a program for project in C, where I have such kind of input:</p>
  
  <pre><code>  ............xcx............
    .........qeztodlea.........
    .......ecnedivorpuzy.......
    .....bqfjwxqindnrsatrs.....
    ....ucaamadisonoctoieax....
    ...ozkttqdxwltstaivcilex...
    ...ujknnakigzfasxninltxc...
    ..rabxaa...kohce...oelnyd..
    ..rithls...momrl...spayvh..
  
        honolulu
    oklahomacity
    charleston
    madison
    montgomery
    saltlakecity
    springfield
  </code></pre>
  
  <p>First set of data is separated from second data set by empty line, I need on one <code>Enter</code> press process it. </p>
  
  <p>If I copy-past this data in terminal window and press <code>Enter</code> and then Ctr+D ( which means end of input ) it works fine, but if to press only <code>Enter</code> I still need to enter data. I can't understand what to change so only on first <code>Enter</code> I'll finish input and proceed to my program? I know that this question sounds stupid, but in my function for reading line I use <code>fgetc</code>, because I need to check some letters, if to use e.g. <code>fgets</code> then it will stop on first <code>nl</code>, which function to use? Maybe I don't get something, is it possible in general?</p>
  
  <p>I already have rLine function for reading line ( using fgetc ):</p>
  
  <pre><code>char * rLine( int * length, int * ha ){
     char *buff = malloc( LMAX ), *old = buff;
     int count = 0, maxlen = LMAX, len = maxlen, c;
  
      while ( (c = fgetc( stdin ) ) != '\n' ){
  
         if ( c == EOF ) { *ha = R_EOF; break; }
  
         if ( /* some conditions for c */ ) *ha = R_FALSE;
  
      *buff ++ = c;
       count++;
  
       if ( -- len == 0 ){  
         len = maxlen;
         buff = (char *)realloc( old, maxlen *= 2 );
         old = buff;
         buff += count;
     }
   }
   *length = count;
   *buff = '\0';
   return old;
  }
  </code></pre>
  
  <p>, where <code>ha</code> some kind of error-message handler. Tnx</p>
  
  <p>NOTE: OK, I've found out that end of input is driven same as <code>CTRL + D</code> combination. so actually the check <code>if ( c == EOF )</code> ( or <code>c == '\0'</code> ) works fine for me. So actually the question can be closed by now.</p>