Chawter
1
I
System
Calls
Close
File
Close
File
Function
Call
10H
Closes an open file and updates the directory information
on that file. This function must be called after a file is
changed to update the directory entry.
If
a
directory entry for the file is found, the location
of
the file is compared with the corresponding entries in the
File Control Block (FCB). The directory is updated, if nec-
essary, to match the FCB.
Entry Conditions:
AH
=
10H
DS:DX
=
pointer to the open
FCB
of
the
file
to close
Exit Conditions:
If
AL
=
00H, the directory entry was found.
If
AL
=
FFH, no directory entry was found.
Macro Definition:
clo5e macro fcb
mov dx,offset fcb
mov ah,l0H
int
21H
endm
Example:
The following program checks the first byte
of
the file
named MOD1.BAS in Drive B
to
see
if
it is FFH, and
prints a message if it is.
message db "Not
saved
in ASCII format",13,10,"$"
fcb db
2,"MODl
BAS"
buffer db
128
dup
(7)
db
25
dup
(1)
func-l0H: set-dta
buffer
;see
Function 1AH
open
fcb ;see Function 0FH
read-
5eq
fcb
;5ee
Function 14H
CmP
buffer,OFFH
;is first byte
FFH?
1ne
all-
done
;no
display
message
;5ee Function
09H
all-
done:
Close
fcb ;THIS FUNCTION
51