/* Programa para leer 4 pistas (0, 1, 2 y 3) de un disco blando y para escribir el contenido al archivo especificado */
#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();
/// Comprobar si la impulsión es lista o no \\\
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();
}
/* Conseguir el nombre del archivo para almacenar los datos de los sectores del disco */
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 */
|