Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!mmdf From: TEMARI%ECAMV1.dnet.ge.com@vm1.nodak.edu Newsgroups: comp.os.minix Subject: (none) Message-ID: <45311@nigel.ee.udel.edu> Date: 21 Feb 91 01:32:19 GMT Sender: mmdf@ee.udel.edu Lines: 129 Here are two programs that I wrote a while back for reading and writing of files to disk drives directly. They were compiled with turboC. I have no utilities with we right now so they are not encoded. They work by reading(rdisk) or writing(wdisk) from/to disk to/from file. They do this by calling the bios to read/write a sector at a time. I wrote these quickly when I had to convert 1.2 floppys to 1.44. They could be changed to write by tracks but there are some problems to overcome with other bios. WARNING: wdisk only allows you to write to drive 0 (A:) and if changed to allow writing anywhere be cautious when using your hard drives (drive 128) because the program will write over them. Hope these help Michael Temari temari@ecamv1.dnet.get.com ----------------------------------------------------------------------------- /* wdisk.c by Michael Temari temari@ecamv1.dnet.ge.com */ #include #include #include void main(argc,argv) int argc; char *argv[]; { FILE *fpin; char buffer[512]; int drive,spt,tracks,sector,track,side,status,i; if(argc!=5) { printf("usage is: %s in_file drive sec/trac tracks\n",argv[0]); exit(1); } if((fpin=fopen(argv[1],"rb")) == NULL) { printf("error: could not open %s\n",argv[1]); exit(1); } drive = atoi(argv[2]); if(drive!=0) { printf("\nDrive 0 is the only valid drive!\n"); exit(1); } spt = atoi(argv[3]); tracks = atoi(argv[4]); printf("Drive:%d\nSectors per Track:%d\nTracks:%d\n",drive,spt,tracks); for(track=0;track #include #include void main(argc,argv) int argc; char *argv[]; { FILE *fpout; char buffer[512]; int drive,spt,tracks,sides,sector,track,side,status,i; if((argc!=5)&&(argc!=6)) { printf("usage is: %s out_file drive sec/trac tracks [sides]\n",argv[0]); exit(1); } if((fpout=fopen(argv[1],"wb")) == NULL) { printf("error: could not open %s\n",argv[1]); exit(1); } drive = atoi(argv[2]); spt = atoi(argv[3]); tracks = atoi(argv[4]); if(argc==5) sides=2; else sides=atoi(argv[5]); printf("Drive:%d\nSectors per Track:%d\nTracks:%d\n",drive,spt,tracks); for(track=0;track