C语言变成:磁盘检测源码片段

把写内容过程比较好的一些内容片段做个珍藏,下面内容是关于C语言变成:磁盘检测片段的内容。
#include <stdio.h>
#include <dos.h>
#include <malloc.h>

void main(void)
{
struct fatinfo fat;
long sector, total_sectors;

getfat(3, &fat);

if ((buffer = malloc(fat.fi_bysec)) == NULL)
printf("Error allocating sector buffern");
else
for (sector = 0; sector < total_sectors; sector++)
if (absread(2, 1, sector, buffer) == -1)
{
printf("n007Error reading sector %ld press Entern",
sector);
getchar();
}
else
printf("Reading sector %ldr", sector);
}

猜你喜欢

转载自blog.51cto.com/14122754/2339303