program delay (sleep)

This is a discussion on program delay (sleep) within the C++ Programming forums, part of the General Programming Boards category; hey every1, a quick question: i would like my program to sleep for a indicated period of time. I am ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    22

    program delay (sleep)

    hey every1, a quick question:
    i would like my program to sleep for a indicated period of time.
    I am using : sleep(2000);
    I have been told that this should compile and the 2000 is in milliseconds. Is this correct or do i need to include a certain file as it is not compiling, also is it correct that the specified time is in milliseconds?
    thanks alot for ur time
    rxg00u

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    22

    Talking change to question

    i have found out that the sleep fucntion is in the windows.h libary. Is there an equivalent to this that can be used with unix
    thanks alot

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    I think unix may have a function called delay().

    delay(num_of_sec);

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    According to this thread, there is a sleep() on POSIX systems.

    http://www.cprogramming.com/cboard/s...ighlight=sleep

  5. #5
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    In <windows> it is Sleep(milliseconds) // note the capital 'S'

    in dos.h for Borland Turbo CLC it is sleep(seconds), but the compiler gives you a warning message that the sleep function is obsolete. (It isn't supported in MSVC++... but since I use borland, I still use it from time to time)
    Blue

  6. #6
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    If you have a delay/sleep executable in unix (you will have to look around a bit) you can run it from within your executable to provide a pause.

    I remember there being one, but since I am on a win box right now, I cannot tell you what the binary name is...
    Blue

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 10:17 PM
  2. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  3. making my program sleep / wait / delay...
    By bobthebullet990 in forum C++ Programming
    Replies: 4
    Last Post: 08-13-2006, 10:14 AM
  4. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

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