中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-01 19:41
48,037 主题排行 / 350,122 发帖 / 今日 2 篇 / 48,249 会员排行
DOS开发编程 & 发展交流 (开发室) » borland c 3.1 的读软盘的DBR的示例代码:改成读硬盘C盘就出措
可打印版本  1,200 / 0
第1楼 GOTOmsdos 发表于 2006-06-22 02:17
铂金会员 发帖 1,827 积分 5,154
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 ]
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023