VOOZH about

URL: https://www.geeksforgeeks.org/c/dos-h-header-in-c-with-examples/

⇱ dos.h header in C with examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

dos.h header in C with examples

Last Updated : 12 Jul, 2025
dos.h is a header file of C Language. This library has functions that are used for handling interrupts, producing sound, date and time functions, etc. It is Borland specific and works in compilers like Turbo C Compiler. Below are the functions supported by this library:
  1. delay(): The delay() function in C is used to stop the execution of the program for some period of time. Syntax:
    delay(unsigned int)
    
    Parameters: It accepts a time in milliseconds to stop the execution of the program to that period of time. Below is the program to illustrate delay():
  2. sleep(): The sleep() function in C is used to delay the execution of the program for some period of time. Syntax:
    sleep(unsigned seconds)
    
    Parameters: It accepts a time in seconds to delay the execution of the program to that period of time. Below is the program to illustrate sleep():
  3. getdate(): The getdate() function in C is used to get the current Date of the system. Syntax:
    getdate(struct date d)
    
    Parameters: It accepts a structure date which is defined in dos.h library itself. To print the date it uses function da_day(), da_mon() and da_year(). Below is the program to illustrate getdate():
  4. gettime(): The gettime() function in C is used to get the Time shown by the System. Syntax:
    gettime(struct time t)
    
    Parameters: It accepts a structure time which is defined in dos.h library itself. To print the date it uses function ti_hour(), ti_min() and ti_sec(). Below is the program to illustrate gettime():
  5. sound(): The sound() function in C is used to play different sound on different frequency on our system. Syntax:
    sound(int frequency)
    
    Parameters: It accepts a frequency and play the sound of that frequency in our system. Below is the program to illustrate sound():
  6. nosound(): The nosound() function in C is used to stop the sound played by souns() function. Syntax:
    nosound()
    
    Parameters: It doesn't accepts any parameters. Below is the program to illustrate nosound():
Comment
Article Tags: