title: how to sleep in c
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1716296/why-does-printf-not-flush-after-the-call-unless-a-newline-is-in-the-format-strin">Why does printf not flush after the call unless a newline is in the format string?</a>  </p>
  </blockquote>
  
  
  
  <p>When I run something like </p>
  
  <pre><code>for (i = 1; i &lt;= 10; i++) {
      sleep(1);
      printf(".");
  }
  </code></pre>
  
  <p>then what I would expect is one dot per second ten times. What I get is ten dots once after ten seconds. Why is that so, and how do I get the program to actually print one point (or do other things) each second (or different time interval)?</p>