Does anyone have a C program with source code for reading a sector from a hard drive with int25 or int13 ?
The program I was trying to use is below, it was written in MS C 5.10,
I have TurboC 2.0. If I include the far pointer it won't compile,
if I don't include it, it doesn't like the FP_ statements.
Any help/comments would be appreciated.


/* Read a Sector from the Harddrive */
#include <stdio.h>
#include <dos.h>

struct parm_block {
unsigned long start_sector;
unsigned num_of_sectors;
char far *buffer;

union REGS inregs, outregs;
struct SREGS segregs;

/* original code had struct far parm_block p_block; */
struct parm_block p_block;

/* construct parameter block */

p_block.start_sector =0;
p_block.num_of_sectors = 1;
p_block.buffer = (char far *) farmalloc(512) ; /* buffer for 1 sector */

/* call function */
inregs.h.al = 0x02; /* drive c */
inregs.x.cx = 0xffff; /* extended calling format */
inregs.x.bx = FP_OFF(p_block); /* xfer pblock offset to bx */
segregs.ds = FP_SEG(p_block); /* xfer pblock segment to ds */
int86x(0x25, &inregs, &outregs, &segregs); /* read sector to buffer */

if ((outregs.x.cflag & 0x01) == 0x01) {
printf("\nError Code: %x", outregs.x.ax); /* check for error*/
/* Process sector here*/
Code from The indispensible PC hardware book by Hans-Peter Messmer