标题: borland c 3.1 的读软盘的DBR的示例代码:改成读硬盘C盘就出措
[打印本页]
作者: GOTOmsdos
时间: 2006-6-22 02:17
标题: borland c 3.1 的读软盘的DBR的示例代码:改成读硬盘C盘就出措
下面是 borland c 3.1 的读软盘的DBR的示例代码:
(改成读硬盘C盘就出措!不知道什么原因? C盘是FAT32格式,DOS下工作正常)
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <dos.h>
int main(void)
{
int i, strt, ch_out, sector;
char buf;
printf("Insert a diskette into drive A and press any key\n");
//getch();
sector = 0;
if (absread(0, 1, sector, &buf) != 0) 第一个 0 改成 2 后,读C盘出错!??
{
perror("Disk problem");
exit(1);
}
printf("Read OK\n");
strt = 3;
for (i=0; i<80; i++)
{
ch_out = buf;
putchar(ch_out);
}
printf("\n");
return(0);
}
Last edited by GOTOmsdos on 2006-6-22 at 02:19 ]