title: sleep() function does not work and print is executed instantaneously
body: <pre><code>static void timeDelay(int no_of_seconds)
  {
  #ifdef _WIN32
      Sleep(1000 * no_of_seconds);
  #else
      sleep(no_of_seconds);
  #endif
  }
  
  void somefunction(){
  printf(&quot;\t\t Load ... \n\t\t&quot;); 
  fflush(stdout); 
  for (int i = 1; i &lt;= 60; i++)
          {
              fflush(stdout);
              timeDelay(1);
              if (i == 31)
                  printf(&quot;\n\t\t&quot;);
              printf(&quot;*****&quot;);
          }
          
    }
  </code></pre>
  <p>I have included the header files too:</p>
  <pre><code>#ifdef _WIN32
      #include &lt;windows.h&gt;
  #else
      #include &lt;unistd.h&gt;
  </code></pre>
  <p>The stars are printed instantaneously.
  I added <code>fflush(stdout)</code> after seeing the answers <a href="https://stackoverflow.com/questions/13568388/c-sleep-function-not-working">here</a>. I also commented out the <code>if (i==31) {}</code> portion to check if that's causing the problem but it isn't. So what is wrong with my code?</p>