home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
C
/
C-FDC
/
RECOV.C
< prev
next >
Wrap
Text File
|
1986-05-06
|
1KB
|
50 lines
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include "fdc.h"
int main()
{
int i, j, k, drive, head, track, start_sect, max_sect, type;
int zflag;
char buf[BUFSIZ * 9 + 1];
char buf1[BUFSIZ * 9 + 1];
FILE *fp;
if((fp = fopen("recov.dat", "wb")) == (FILE *)NULL) {
fprintf(stderr, "Can't open the output file!\n");
exit(1);
}
drive = 0; /* set drive to A */
type = 2; /* set 320/360K disk in 1.2 M drive */
start_sect = 1;
max_sect = 9;
if(setdasd(drive, type)) {
fprintf(stderr, "Can't set the dasd for drive A!\n");
fclose(fp);
exit(1);
}
for(track = 0; track < 40; track++)
for(head = 0; head < 2; head++)
for(i = 0; i < 3; i++) {
if(rdtrack(drive, head, track, start_sect, max_sect, buf) == 0) {
for(j = 0, k = 0; j < BUFSIZ * 9; ++j)
if(buf[j] != 0xf6 && buf[j] != 0x1a && buf[j])
buf1[k++] = buf[j];
fwrite(buf1, sizeof(char), k, fp);
break;
} else {
fprintf(stderr, "failure %d on head %d, track %d\n", i, head,
track);
}
}
fclose(fp);
printf("done\n");
exit(0);
}