Thread: I know this question has been asked hundreds of times, but How do you...

  1. #1

    I know this question has been asked hundreds of times, but How do you...

    I need help on making the program wait abit. I can use wait(), but for some reason, it locks up the comp when I try it in 13h mode. I tried doing a for loop that doesnt do anything for abit, but once I get the number up high enough for a noticable pause, the one thing where if something repeats enough the program aborts.

    I just need a pause for so many seconds routine.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    7
    If you're programming for the Windows platform you can use the Win32 API function 'Sleep'. If your program is running exclusively on its own and you don't care how much CPU it takes up, you can write your own wait function with the functions in <time.h> (<ctime>):

    void Wait(int iSeconds)
    {
    time_t iEnd = time() + iSeconds;

    while (time() < iEnd)
    ;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Exam Question - Possible Mistake?
    By Richie T in forum C++ Programming
    Replies: 15
    Last Post: 05-08-2006, 03:44 PM
  2. I need help to compile this code...
    By wise_ron in forum C Programming
    Replies: 17
    Last Post: 05-07-2006, 12:22 PM
  3. Question about binary trees and files
    By satory in forum C Programming
    Replies: 9
    Last Post: 03-06-2006, 06:28 AM
  4. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 03:57 PM
  5. A question asked a million times, but where do I start?
    By Unregistered in forum Game Programming
    Replies: 10
    Last Post: 09-09-2001, 09:15 AM