如何写磁盘指定扇区

yw1621 2004-11-17 07:41:47
各位高手,请问如何用程序写磁盘指定扇区??
...全文
156 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
yw1621 2004-11-20
  • 打赏
  • 举报
回复
多谢各位了
柯本 2004-11-20
  • 打赏
  • 举报
回复
windows 2000下

http://dev.csdn.net/article/48/48903.shtm
柯本 2004-11-20
  • 打赏
  • 举报
回复

#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <dos.h>

int main(void)
{
int i, strt, ch_out, sector;
char buf[512]; /* 将要写的放入buf */

printf("Insert a diskette into drive A and press any key\n");
getch();
sector = 0;
if (abswrite(0, 1, sector, &buf) != 0)
{
perror("Disk problem");
exit(1);
}
printf("Write OK\n");
return(0);
}
柯本 2004-11-20
  • 打赏
  • 举报
回复
与系统有关,纯dos下,用TC:

absread and abswrite absread reads absolute disk sectors
abswrite writes absolute disk sectors
(Not available under MS-Windows.)

Syntax:
int absread(int drive, int nsects, long lsect, void *buffer);
int abswrite(int drive, int nsects, long lsect, void *buffer);

Prototype in:
dos.h

■ drive is 0 = A, 1 = B, 2 = C, etc.
■ nsects is the number of sectors to read/write
■ lsect is starting logical sector (0 is first)
■ buffer is address of data area.

The number of sectors to read or write is limited to the amount of memory in
the segment above the buffer.

64K is the largest amount of memory per call that can be read in or written.

Returns 0 for success; on error, returns -1 and sets errno.
yw1621 2004-11-20
  • 打赏
  • 举报
回复
快快
yw1621 2004-11-20
  • 打赏
  • 举报
回复
C应该是可以写磁盘指定扇区的,到底该怎么写啊???
上学时没教啊
yw1621 2004-11-20
  • 打赏
  • 举报
回复
是的
Flood1984 2004-11-19
  • 打赏
  • 举报
回复
想做启动盘是不?
yw1621 2004-11-19
  • 打赏
  • 举报
回复
up
yw1621 2004-11-19
  • 打赏
  • 举报
回复
不是吧,这个问题没人会啊
yw1621 2004-11-17
  • 打赏
  • 举报
回复
请各位大侠帮帮小弟了,谢谢了!!!

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧