磁盘检测C语言代码片段

2015-07-03 0 279
磁盘检测C语言代码片段
#include <stdio.h>
#include <dos.h>
#include <malloc.h>
 
void main(void)
 {
   struct fatinfo fat;
   long sector, total_sectors;
   void *buffer;
 
   getfat(3, &fat);
   total_sectors = fat.fi_nclus * fat.fi_sclus;
 
   if ((buffer = malloc(fat.fi_bysec)) == NULL)
     printf("Error allocating sector buffer\n");
   else
     for (sector = 0; sector < total_sectors; sector++)
       if (absread(2, 1, sector, buffer) == -1)
        {
          printf("\n\007Error reading sector %ld press Enter\n",
            sector);
          getchar();
        }
       else
         printf("Reading sector %ld\r", sector);
 }

遇见资源网 c/c++ 磁盘检测C语言代码片段 http://www.ox520.com/10264.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务