Thread: sleep... ahhhh...

  1. #1
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    Question sleep... ahhhh...

    I use borland. For a while now I've been working on using the sleep functions... none of them work... can anyone give me a working sleep function (that doesn't use the processer ticks... or whatever ya might call it)?

  2. #2
    Registered User blight2c's Avatar
    Join Date
    Mar 2002
    Posts
    266
    i used this in bcc55, is it the same thing as sleep

    Code:
    #include <iostream.h>
    #include <time.h>
    
    int f_wait (int);
    
    main()
    {
    	f_wait (4);
    	cout<<"hello";//notes
    	return(0);
    }
    
    int f_wait(int SecondsToWait)
    {
    	time_t TheTime = time(NULL);
    	while(time(NULL) - TheTime < SecondsToWait);
    	return 1;
    }
    where 'bouts ny are you from?
    Last edited by blight2c; 03-30-2002 at 10:02 PM.

  3. #3
    Registered User
    Join Date
    Aug 2001
    Location
    computers/ theatre, travelingstudentL>- Northern California NativeNorthern California3D&Tie-DyeStudent1>. Admirer of C Bangalore Net surfingTeacher >/ >0 nagpurteaching >1  >2
    Posts
    61
    Look at the man page for 'setitimer'

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    If it's a newer version of borland, it should have Sleep().

    #include <windows.h>
    .
    .
    Sleep(1000); //Sleep 1 second

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sleep works with just one thread, but not 2
    By finkus in forum C++ Programming
    Replies: 5
    Last Post: 12-01-2005, 09:17 PM
  2. Problem with Sleep() #$@^#$%^
    By intruder in forum C++ Programming
    Replies: 8
    Last Post: 10-11-2004, 06:46 AM
  3. why do we require sleep?
    By jinx in forum A Brief History of Cprogramming.com
    Replies: 43
    Last Post: 07-14-2004, 08:21 AM
  4. Sleep is overrated...
    By Polymorphic OOP in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 01-24-2003, 12:40 PM
  5. sleep
    By ivandn in forum Linux Programming
    Replies: 7
    Last Post: 12-13-2001, 11:20 PM