Thread: Delay function

  1. #1
    Registered User
    Join Date
    Jan 2002

    Delay function

    Can you tell me a function in a program comment it. not delay();.anything else than delay() to wait for a few milliseconds or seconds?

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    There's Microsoft C source code for a delay function, or you could write an empty loop that repeated itself hundreds of times. This solution however, would vary grealty from PC to PC.

  3. #3
    Registered User
    Join Date
    Oct 2001
    What operating system and compiler are you using?

  4. #4
    Has a Masters in B.S.
    Join Date
    Aug 2001
    #inculde <stdlib.h>

    int main(void)
    // do what ever
    sleep(100); // sometimes _sleep(), where the arguement is the ammount of time in milliseconds to wait(sleep).
    // do something else
    return 0;
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  5. #5
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    assuming you are using a console in a windows environment then....

    #include <windows.h>

    Sleep(x); // where x is the number of millisecs minimum you wish to pause for. Notice the capital S. remember that c++ is case sensitive.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :-

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  4. Replies: 4
    Last Post: 11-23-2003, 07:15 AM
  5. Time delay function
    By sundeeptuteja in forum C++ Programming
    Replies: 4
    Last Post: 02-10-2003, 05:17 AM