pausing the system

This is a discussion on pausing the system within the C++ Programming forums, part of the General Programming Boards category; I need help in pausing the system. I want some kind of timed pause. I have heard of some people ...

  1. #1
    Unregistered
    Guest

    pausing the system

    I need help in pausing the system. I want some kind of timed pause. I have heard of some people using some sort of time functions to pause the system for a allowed amount of time.

    Your help is appreciated.

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    1
    #include <dos.h>

    main()
    {
    ....
    ....
    delay(1000); //Approx 1 sec.
    ....
    }

  3. #3
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    Yeah, use delay or some time function like that. There might be a predefined constant that represents one second on all computers so that it will run the same way on AMD 1.4's as it would run on PII 400mhz systems. Not too sure though.

    Just noticed "dos.h". That is not too good. Look for something under "time.h" instead.
    Last edited by Troll_King; 10-17-2001 at 07:39 PM.

  4. #4
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    Posts
    125

    Post

    If you are working under UNIX you could have used the following functions:

    sleep(num_of_seconds_to_sleep);

    usleep(num_of_microseconds_to_sleep);

    If you are working under other platform, look for their equivalent in time.h, utime.h or other time related header files.
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

  5. #5
    Registered User dune911's Avatar
    Join Date
    Sep 2001
    Posts
    140

    the easiest way...

    i think the easiest way is

    #include <conio.h>

    and then just use the

    getch();

    command in the program.

    but notice: this is a "press-any-key-to-continue" function...

  6. #6
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    Posts
    125
    Dear Dune911,

    by using getch() there is no way to implement a time-based delay. getch() will cause an infinite delay unless someone actually enters something on a keyboard.

    Cheers
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File System Implementation
    By dodgeviper in forum C Programming
    Replies: 9
    Last Post: 11-16-2007, 01:04 PM
  2. Using system icons
    By @nthony in forum Windows Programming
    Replies: 1
    Last Post: 01-13-2007, 07:56 PM
  3. Linux database system needed
    By BobS0327 in forum Tech Board
    Replies: 7
    Last Post: 06-11-2006, 04:56 PM
  4. measuring system resources used by a function
    By Aran in forum C Programming
    Replies: 1
    Last Post: 03-13-2006, 05:35 PM
  5. BIOS system and memory allocation problem
    By beely in forum Tech Board
    Replies: 9
    Last Post: 11-25-2003, 07:12 AM

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