www.pudn.com > TP333.3_S886.rar > CWSE.C


//******************************************** 
//文件名:CWSE.C 
//功能:将文件数据写入0面0头7扇区 
//******************************************** 
#include                           //1. 
#include                            //2. 
void main()                                 //3. 
{                                           //4. 
   char h[512];                             //5. 存放扇区数据 
   char sh[13];                             //6. 存放文件名 
   FILE *fp;                                //7. 
   int i;                                   //8. 
   int cyl=0,head=0,sector=7;               //9. 柱面,磁头,扇区编号 
   printf("Enter file name: ");             //10. 
   scanf("%s",sh);                          //11. 输入文件名 
   fp=fopen(sh,"rb");                       //12. 打开文件 
   for(i=0;i<=511;i++)                      //13. 
     h[i]=fgetc(fp);                        //14. 将文件数据读入数组 
   biosdisk(0x03,0x80,head,cyl,sector,1,h); //15. 调用函数将数组数据写入扇区 
   fclose(fp);                              //16. 关闭文件 
}                                           //17.