Skip to content
Thomas Foster edited this page Mar 22, 2021 · 1 revision

Function   Suspends execution for an interval (seconds).

Syntaxvoid sleep(unsigned seconds);

Prototype in   dos.h

Return value   None.

See also delay

Remarks

With a call to sleep, the current program is suspended from execution for the number of seconds specified by the argument seconds.

Example

#include <dos.h>
#include <conio.h>

int main()
{
    initdos();

    cprintf("My Program (C) 2021\n");
    cprintf("by Me");
    sleep(3); /* pause to let the user read the program info */
    clrscr();

    /* run program
    while (1) {
        /* ... */
    }

Header Files

Clone this wiki locally