PT630 Programming Reference Guide
Page 40 of 59
------------------------------------------------------------------------------------------------------------------
1.5.28.2 Open File with Handle
Entry Parameter: AH = 3DH
AL
=
0
;
read
only
1
; write only
2
; read and write
DS:DX
; pointer to file name buffer
Return Value: if success, AX = Handle and CARRY flag is cleared
if failed , AX = 2 and CARRY flag is set
Example:
int TS_open_file(char *fn,int mode)
{
regs.h.ah=0x3Dh;
regs.h.al=(unsigned char)mode;
segregs.ds = FP_SEG(fn);
regs.x.dx = FP_OFF(fn);
int86x(0x21,®s,®s,&segregs);
if ((regs.x.cflag & 0x01) == 1) return(-1);
else return(regs.x.ax);
}
1.5.28.3 Close File with Handle
Entry Parameter: AH = 3EH
BX = Handle of file
Return Value: if success, CARRY flag is cleared
if failed, CARRY flag is set
Example:
void TS_close_file(int hdl)
{
regs.h.ah= 0x3e;
regs.x.bx= hdl;
int86(0x21,®s,®s);
if ((regs.x.cflag & 0x01) == 1) return(-1);
else return(1);
}