title: In C, How to exit a loop based on file contents
body: <p>I'm attempting to exit a while loop, based on file contents. File exists and is empty, or garbage filled at initialization of the program. I externally modify the file, and would like the loop to exit upon this happening based on how the file was modified.</p>
  
  <p>Currently, I start a few threads, open the file that I'm reading from. Check the first byte. If it is a one, I exit, else start the loop. </p>
  
  <p>When I'd like to exit. I put a one in the first byte, but it appears my file is never read again.</p>
  
  <p>While loop statement and variable definition each loop looks like:</p>
  
  <pre><code> while(strcmp(fileContents, "1\n") != 0){
  
      lengthRead = fread(fileContents, 1, size, isRecording);
      fseek(isRecording, 0, SEEK_SET);
  </code></pre>
  
  <p>I know there are probably simpler ways to exit a while loop externally, but based on the architecture of my project, the only way I can see how to control this is to exit based on file contents.</p>