time delay function available?

This is a discussion on time delay function available? within the C Programming forums, part of the General Programming Boards category; Is there some kind of time delay function available? Thanks....

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    2

    Question time delay function available?

    Is there some kind of time delay function available? Thanks.

  2. #2
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    there is,
    just include <windows.h>
    and then you can use Sleep(x);
    where x is the number of milliseconds and Sleep must be capitalized.

    if its for a non windows o/s i think you can use _sleep(x) defined in conio.h
    Monday - what a way to spend a seventh of your life

  3. #3
    Unregistered
    Guest
    I think this can be done without recourse to anything but the standard libraries

    void delay(time_t d)
    {
    time_t start;
    time(&start);
    while( time(NULL) < start+d);
    }

  4. #4
    Unregistered
    Guest
    you will have to
    #include <time.h> in the above code .

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  2. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 09:18 AM
  3. The space time continueimnms mm... (rant)
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 32
    Last Post: 06-27-2004, 01:21 PM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 06:18 AM
  5. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM

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