some kind of timer...

This is a discussion on some kind of timer... within the C++ Programming forums, part of the General Programming Boards category; I'd like to do a proggy that will count to - for example - 100 in one seconds interval... and ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    16

    some kind of timer...

    I'd like to do a proggy that will count to - for example - 100 in one seconds interval... and execute some code in every second... any ideas???

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,655
    time.h

    clock()

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    267
    or you could use Sleep()

    Code:
    #include <windows.h>
    ...
    for (int i = 0; i < 100; i++)
    {
              some code
              Sleep(1000) // pause for 1 second (1000 milliseconds)
    }
    Sleep is an Win32 API command; it's simple and gets the job done.
    Last edited by d00b; 07-31-2002 at 03:22 PM.

  4. #4
    Registered User
    Join Date
    Jul 2002
    Posts
    16
    thank you both guys, especially for d00b !!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SIGALRM and timer
    By nkhambal in forum C Programming
    Replies: 1
    Last Post: 06-30-2008, 12:23 AM
  2. tic tac toe crashes :(
    By stien in forum Game Programming
    Replies: 4
    Last Post: 05-13-2007, 06:25 PM
  3. Need help with a count down timer
    By GUIPenguin in forum C# Programming
    Replies: 0
    Last Post: 07-07-2006, 04:18 PM
  4. Timer again.
    By geek@02 in forum Windows Programming
    Replies: 1
    Last Post: 05-04-2005, 10:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21