https://vustudents.ning.
com/
CS609 Assignment 3 Solution Fall 2020
Solution
Coding
#include <bios.h>
#include <dos.h>
#include <stdio.h>
FILE *fp;
unsigned char buf[512];
unsigned char st[60];
unsigned char headno[10 ];
unsigned char secno[10 ];
unsigned char unsigned char trackno[10 ] ;
void main (void)
{
int i;
for (i = 0; i < 512; i++)
buf[i] = 0;
printf("Please Enter Name ot the file);
gets(st);
fp=fopen(st,"wb");
printf("Please Enter Head Number:");
gets(headno);
printf("Please Enter Sector Number:");
gets(secno);
printf("Please Enter Track Number");
gets(trackno);
i = biosdisk(2,0x00,atoi(headno), atoi(trackno),atoi(secno),1, buf) ;
if (*(((char *)(&i))+1)== )
{
fwrite(buf,1,512,fp);
fclose(fp);
printf("Data is Written Successfully on the file");
}
else
{
printf("Cannot Read Error",i);
https://vustudents.ning.com/
}
getch();
}
The END