Thread: How to pause

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    98

    How to pause

    How can I pause a program for a specific number number of seconds? I'm using MS Visual C 6.0.
    Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Sleep() as defined in windows.h
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Include "windows.h" and use "Sleep()" - the Sleep function takes number of milliseconds, so you need to say "Sleep(1000)" to sleep for one second.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    98
    At first it wouldn't work, but then I realized I was typing sleep instead of Sleep.
    Thanks for the help!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fork(), pause(), and storing PID's in a linked list
    By vital101 in forum C Programming
    Replies: 10
    Last Post: 09-28-2007, 02:16 AM
  2. Why doesn't this cin.get() pause the program?
    By Loctan in forum C++ Programming
    Replies: 5
    Last Post: 06-24-2006, 04:06 PM
  3. pause
    By Moffesto in forum C++ Programming
    Replies: 4
    Last Post: 06-21-2002, 10:15 AM
  4. Problem with the pause function
    By indigo0086 in forum C++ Programming
    Replies: 1
    Last Post: 11-03-2001, 12:38 PM
  5. Pause function ???
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 09-02-2001, 08:22 PM