#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    3
    Rep Power
    0

    C++ function question


    I have a function that I want to call another function but only after a certain amount of time. Is this possible and if so, I would I do it?
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    With what compiler and under what operating system? For a GUI target or command-line? That can make a lot of difference, since time delays are usually system dependent.

    Also, do you want your application to go to sleep during that delay or be doing other things?
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    3
    Rep Power
    0
    I'm using Visual C++ running WIN 98SE but the program will be graded on a computer running WIN 2000. Yes this is for school.

    Command-line.

    This is an ATM program. I have a function that simply displays a good-bye screen after you're done doing your business but I want the program to restart automatically after a few seconds once the good-bye screen is displayed. I know it basically creates an infinte loop but that's what I want.
  6. #4
  7. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    The Win32 API has a Sleep() function:
    VOID Sleep(
    DWORD dwMilliseconds // sleep time in milliseconds
    );
    You should find it in your VC++ help (from which I just copied that prototype) or on the MSDN site.

IMN logo majestic logo threadwatch logo seochat tools logo