home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
drdobbs
/
ddjcompr
/
hstest
/
lib
/
farread.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-08-14
|
626b
|
38 lines
#include <dos.h>
#include <tomlib.h>
int far_read (int handle,char far *buffer,int count)
{
union REGS ir;
struct SREGS sr;
ir.h.ah = 0x3f;
ir.x.bx = handle;
ir.x.cx = count;
ir.x.dx = FP_OFF(buffer);
sr.ds = FP_SEG(buffer);
intdosx (&ir, &ir, &sr);
if (ir.x.cflag)
return -1;
return ir.x.ax;
}
int far_write (int handle,char far *buffer,int count)
{
union REGS ir;
struct SREGS sr;
ir.h.ah = 0x40;
ir.x.bx = handle;
ir.x.cx = count;
ir.x.dx = FP_OFF(buffer);
sr.ds = FP_SEG(buffer);
intdosx (&ir, &ir, &sr);
if (ir.x.cflag)
return -1;
return ir.x.ax;
}