Thread: sleep()

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    6

    sleep()

    does C++ has this function header for this :

    sleep()?

    I really need help

  2. #2
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    I'm on Unix , and if I include < unistd.h >
    i can use sleep(int) where int is how many seconds to sleep.

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    87
    Its <windows.h>, and make sure you spell it Sleep(int), note the Uppercase S, and this has been posted before.
    **********************
    *==================*
    * Many Can. One Must... *
    *==================*
    **********************

  4. #4
    Registered User Kupo's Avatar
    Join Date
    Dec 2001
    Posts
    36
    Code:
    #include <windows.h>
    
    void Sleep   
    (
      DWORD dwMilliseconds
    );
    
    int main()
    {
    sleep(int);
    }

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    6
    thank you so much


    I see someone uses it , but mis-spelling, then it doesn't work.

    one more question,

    is there a delay() for function header and gotoxy(int,int)?

    i have a headage homework.. newbee though,
    that I have to write a c++ program to scroll a user input message accross screen (like java does), and make it blinking..

    It is fun and does headage after all, then I need to find resource and help.
    Last edited by john111111; 12-06-2002 at 01:50 AM.

  6. #6
    Registered User
    Join Date
    Nov 2002
    Posts
    87
    If you use DEV-C++ to compile clrscr(); will help to make it flash, use conio.c. But if you use MSVC++ use cout << endl; just before using SYSTEM("CLS"); as it clears the buffer. Windows.h for this one. Should help you with most of it. Then you just have to place it in an appropriate loop.
    **********************
    *==================*
    * Many Can. One Must... *
    *==================*
    **********************

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [pthread] cancellable sleep in win32?
    By cyberfish in forum C++ Programming
    Replies: 2
    Last Post: 08-11-2007, 02:30 AM
  2. 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
  3. Problem with Sleep() #$@^#$%^
    By intruder in forum C++ Programming
    Replies: 8
    Last Post: 10-11-2004, 06:46 AM
  4. 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
  5. Sleep is overrated...
    By Polymorphic OOP in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 01-24-2003, 12:40 PM