Tutorial references

c
c++
c#

Tutorial references

chapters

DOS in C (dos.h)

dos.h

Include dos.h header file in your c program.

dos.h functions work in "turbo c++" compiler.

sleep

sleep() function delays program execution for given time(in seconds).

Syntax:

sleep(second);

Example

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

void main(){
clrscr();
printf("wait 10 seconds ");
sleep(10);
printf("\nwww.sabbla.com");// This line of code execute after 10 seconds
getch();
}

Run program

delay

delay() function is used to suspend execution of program for given time.

10000 millisecond = 1 second

Syntax:

delay(milliseconds);

Example

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

void main(){
clrscr();
printf(" After 10 second program will be run");
delay(10000);
printf("\nwww.sabbla.com"); //This line of code execute after 10 seconds.
getch();
}

Run program

getdate

getdate() returns current date of computer.

Example

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

void main(){
struct date d;
getdate(&d);
printf("Current system date: %d/%d/%d",d.da_day,d.da_mon,d.da_year);
getch();
}

Run program

gettime

gettime() returns current time of computer.

Example

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

void main(){
struct time t;
gettime(&t);
printf("Current system time:- %d : %d : %d",t.ti_hour,t.ti_min,t.ti_sec);
getch();
}

Run program

setdate

setdate() used to set date of computer.

Example

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

void main()
{
struct date d;
clrscr();
printf("Enter day: ");
scanf("%d",&d.da_day);
printf("\nEnter month: ");
scanf("%d",&d.da_mon);
printf("\nEnter year: ");
scanf("%d",&d.da_year);
setdate(&d);
printf("\nCurrent system date: %d/%d/%d\n",d.da_day,d.da_mon,d.da_year);
getch();
}

Run program

nosound

nosound() is used to turn off PC Speaker.

Example

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

void main(){
clrscr();
printf("PC speaker Turn off");
nosound();
getch(); }

Run program

sound

sound() function change sound quality on given frequencies. Use random frequence and enjoy with music.

Syntax:

sound(frequencies)

Example

#include <stdio.h>
#include <conio.h>

void main()
{
int a;
clrscr();
printf("Music start\n");
for ( a = 400 ; a <= 10000 ; a = a + 200 ){
sound(a);
delay(50);
}
nosound();
getch();
}

Run program

About Us

This website(www.sabbla.com) is very useful for beginners and professional developers. Sabbla provides tutorial in simple language. It provides latest technology tutorial which very useful for developers.

See More...

Contact Us

+91 9971366710

+91 9717983128

info@sabbla.com

Buxar, Bihar, India, Pin No.- 802131

Services

Sabbla is providing free latest technology tutorials. All tutorials are free for beginner and professionals.


Terms of Use

sabbla.com is not responsible for any mistake. Users can inform to sabbla.com for any mistake. But sabbla.com always try for 0-0 mistake.

Privacy policy

Currently sabbla.com does not collect any data from users.

                   

copyright © 2017-2018