/* Program to read 4 tracks (0, 1, 2 and 3) of a floppy and write the contents to specified file */
#include <bios.h>
#include <stdio.h>
#include<conio.h>
void main(void)
{
int head,track;
int result,i,sector;
char filename[80];
char *buffer;
struct diskinfo_t dinfo;
static char dbuf[512];
FILE *tt;
clrscr();
/// Check if drive is Ready or Not \\\
if(!(biosdisk(4,0,0,0,0,1,buffer) & 0x02))
{
printf(" Drive A: Not Ready:\n Insert disk into Drive A:
and press any key\n");
getch();
}
/* Get the file name to store the data of the Sectors of
the disk */
printf("\nEnter the Destination File name with full Path
to store the data \n\n >");
gets(filename);
if((tt= fopen(filename, "wb"))==NULL)
{
printf("Could not open the File!!!");
getch();
}
for(track=0;track<4;track++)
{
for(head=0; head<=1;head++)
{
for(sector=1;sector<=18;sector++)
{
dinfo.drive = 0; /* drive number for A: */
dinfo.head = head; /* disk head number */
dinfo.track = track; /* track number */
dinfo.sector = sector; /* sector number */
dinfo.nsectors = 1; /* sector count */
dinfo.buffer = dbuf; /* data buffer */
|