[SOLVED] C program using BIOSDISK function for a removable disk attached with system. Check whether it is ready for access or not. Read the drive parameters

Issue

Write C language program to complete the following three tasks using BIOSDISK function.
Suppose one removable disk is attached with your system. Check whether it is ready for access or not. Show appropriate messages in either case.
Read the drive parameters of the first removable disk of the system. (The drive parameters will be returned in the buffer that is passed as a parameter). After reading, write the contents of the buffer in a file.
Format Track number 1 and set the bad-sector Flags (if bad-sectors are present) of first removable disk of your system. The remaining parameters should be as follows:
Head number = 0, Sector number = 1, Total number of sectors (nSect) = 1

Solution

use biosdisk(int command No, int drive No, int head No, int track No, int sector No, void *buffer);
Drive is a number that specifies which disk drive is to be used:

0 for the first floppy disk drive, 1 for the second floppy disk drive, 2 for the third, and so on.
For hard disk drives, a drive value of 0x80 specifies the first drive, 0x81 specifies the second, 0x82 the third, and so forth.

Answered By – Abdul Qayyum

Answer Checked By – Terry (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.