title: Read from a file that is continuously being updated
body: <p>I am writing some C code to process some data in a file, but I just learned that the file is going to be constantly added to (about 1 time/second, maybe faster).  So I'm wondering how do I keep reading from the file as its being added to.  Then when I get to the end, wait until the next line is added and then process it.  Then wait again and then process, and so on and so on.  I have something like:</p>
  
  <pre><code>while(1){
      fgets(line, sizeof(line), file);
      while(line == NULL){
         //wait ?  then try to read again?
      }
      //tokenize line and do my stuff here
  }
  </code></pre>
  
  <p>I thought I could maybe use inotify, but I am getting nowhere with that.  Does anyone have any advice?</p>