You are here

dos.h

sleep in C

Sleep function delays program execution for a given number of seconds.

Declaration: void sleep(unsigned seconds);

C programming code for sleep

#include <stdio.h>
#include <dos.h>

C sound program

Sound function produces the sound of a specified frequency. Used for adding music to a C program, try to use some random values in loop, vary delay and enjoy.

Declaration: void sound(unsigned frequency);

C programming code for sound (Turbo C compiler only)

#include <dos.h>

gettime c

gettime in c: gettime function is used to find current system time. We pass address of a structure varibale of type ( struct time ).

C programming code for gettime

#include<stdio.h>
#include<dos.h>

getdate C

Program to print current system date, getdate C code below explain how to use this function to print computer date.

Getdate example

C programming code to print date

#include<stdio.h>
#include<dos.h>

Delay function in C

Delay in C: delay function is used to suspend execution of a program for a particular time.

Declaration: void delay(unsigned int);

Here unsigned int is the number of milliseconds( remember 1 second = 1000 milliseconds). To use delay function in your program you should include the dos.h header file.

C programming code for delay

#include<stdio.h>
#include<stdlib.h>

main()
{
    printf("This C program will exit in 10 seconds.\n");        

    delay(10000);                        

    return 0;
}

Subscribe to RSS - dos.h