Timer to terminate program

This is a discussion on Timer to terminate program within the C++ Programming forums, part of the General Programming Boards category; I have to write a program that will terminate after 30 seconds, I have not a clue on how to ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    3

    Timer to terminate program

    I have to write a program that will terminate after 30 seconds, I have not a clue on how to go about ending it in the specified time frame...

    Any help would be greatly appreciated.

    Thank You!

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    16
    I recommend using a loop within loop. Use simple counting loops

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    3
    My OS is XP home, I'm using Microsoft's Visual C++ 6.0, & this will be a console app.

  4. #4
    Registered User
    Join Date
    Feb 2003
    Posts
    162
    create a DWORD value and continuously get do timeGetTime()...add it to itself over and over, and then have this all in a while loop
    Code:
    while (DWORD value < 30000)
    {
    	DWORD value = timeGetTime();
    	DWORD value += DWORD value;
    }
    of course, thats just something thrown randomly together, but it might work

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    3
    Right on! Thanks everyone.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 11:58 PM
  2. Why does the program terminate at "fscanf" function?
    By Mathsniper in forum C Programming
    Replies: 3
    Last Post: 05-22-2006, 12:23 PM
  3. Need Delimiter Program helpful hints.
    By Unregistered in forum C Programming
    Replies: 7
    Last Post: 02-16-2002, 06:27 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

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