home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_10_05
/
1005111a
< prev
next >
Wrap
Text File
|
1992-03-05
|
1KB
|
40 lines
Listing 2
*********
#include <stdio.h>
#include <dos.h>
#define SIZE_CLUSTER 2048 /* This may need to be changed */
#define SECTOR_OFFSET 145 /* This may also need to be changed */
get_cluster(cluster, drive, buffer)
unsigned int cluster; /* Cluster to get */
int drive; /* 0 = A, 1 = B, etc. */
unsigned char buffer[];
{
union REGS inregs, outregs;
struct SREGS segregs;
unsigned int cluster;
unsigned int sector;
int dos_ret;
int ret;
int i;
char dir_name[100];
char filename[100];
char textname[100];
segregs.ds = ((unsigned long) buffer) >> 16;
sector = cluster * 4 + SECTOR_OFFSET;
inregs.h.ah = 0;
inregs.h.al = 0x2;
inregs.x.cx = 4;
inregs.x.bx = ( (long) buffer) & 0XFFFF;
inregs.x.dx = sector;
dos_ret = int86x( 0x25, &inregs, &outregs , &segregs);
/* The dos_ret could be checked here if int86x returns it */
return ret;
}
******