/* 经过4轨道工程(0、1、2、3),写出一个柔弱特定档案内容 */
#include <bios.h>
#include <stdio.h>
#include<conio.h>
void main(void)
{
int head,track;
int result,i,sector;
char filename[80];
char *buffer;
struct diskinfo_t dinfo;
static char dbuf[512];
FILE *tt;
clrscr();
/// 看看是否准备驾车 \\\
if(!(biosdisk(4,0,0,0,0,1,buffer) & 0x02))
{
printf(" Drive A: Not Ready:\n Insert disk into Drive A:
and press any key\n");
getch();
}
/* 使档案名称储存数据的部门的磁盘 */
printf("\nEnter the Destination File name with full Path
to store the data \n\n >");
gets(filename);
if((tt= fopen(filename, "wb"))==NULL)
{
printf("Could not open the File!!!");
getch();
}
for(track=0;track<4;track++)
{
for(head=0; head<=1;head++)
{
for(sector=1;sector<=18;sector++)
{
dinfo.drive = 0; /* 为推动数字: */
dinfo.head = head; /* 盘头多 */
dinfo.track = track; /* 多轨道 */
dinfo.sector = sector; /* 一些部门 */
dinfo.nsectors = 1; /* 计部门 */
dinfo.buffer = dbuf; /* 数据缓冲 */
|