複製鏈接
請複製以下鏈接發送給好友

absread

鎖定
absread, abswrite,功 能 絕對磁盤扇區讀、寫數據,用 法 int absread(int drive, int nsects, int sectno, void *buffer);
中文名
absread
外文名
absread, abswrite
功 能
絕對磁盤扇區讀、寫數據
buffer
=要讀、寫入數據的內存起始地址

目錄

absread定義

用 法: int absread(int drive, int nsects, int sectno, void *buffer);
int abswrite(int drive, int nsects, int sectno, void *buffer);

absread參數説明

drive=0(A驅動器)、1(B驅動器)、
nsects=要讀、寫的扇區個數(最多64K個);
sectno=起始邏輯扇區號;
程序例:
/* absread example */
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <dos.h>
int main(void)
{
int i, strt, ch_out, sector;
char buf[512];
printf("Insert a diskette into drive A and press any key\n");
getch();
sector = 0;
if (absread(0, 1, sector, &buf) != 0)
{
perror("Disk problem");
exit(1);
}
printf("Read OK\n");
strt = 3;
for (i=0; i<80; i++)
{
ch_out = buf[strt+i];
putchar(ch_out);
}
printf("\n");
return(0);
}