May 27
#include<dos.h> #include<stat.h> #include<conio.h> #include<stdio.h> #include<fcntl.h> #include<io.h> void main() { int in,bytes,i,n; char buf[512]; clrscr(); in=open("sect.dat",O_CREAT|O_BINARY|O_WRONLY); gotoxy(25,2); printf("Sector reader\n"); for(i=1;i<=2847-1;i++) { absread(0,1,i,&buf); write(in,buf,512); gotoxy(15,5); printf("%d sectors readed",i); } close(in); gotoxy(15,7); printf("\nEnter target disk"); wait; in=open("sect.dat",O_BINARY|O_RDONLY); for(i=1;i<=1439;i++) { read(in,buf,512); n=abswrite(0,1,i,&buf); if(n!=0) { gotoxy(15,10); printf("%3d th sector skipped"); } gotoxy(15,12); printf("sectors written = %3d",i); } close(in); } |
Recent Comments