Forces all data in MS-DOS's internal buffers associated with a specified handle to be physically written to the device. If the handle refers to a file, and the file has been modified, the time and date stamp and file size in the file's directory entry are updated.
Call with:
AH = 68H
BX = handle
Returns:
If function successful
Carry flag = clear
If function unsuccessful
Carry flag = set
AX = error code
Notes:
The effect of this function is equivalent to closing and reopening a file, or to duplicating a handle for the file with Int 21H Function 45H and then closing the duplicate. However, this function has the advantage that it will not fail due to lack of handles, and the application does not risk losing control of the file in multitasking or network environments.
If this function is requested for a handle associated with a character device, a success flag is returned, but there is no other effect.
Example:
Assume that the file MYFILE.DAT has been previously opened and that the handle for that file is stored in the variable fhandle. Call the Commit File function to ensure that any data in MS-DOS's internal buffers associated with the handle is written out to disk and that the directory and file allocation table are up to date.
fname db 'MYFILE.DAT',0 ; ASCIIZ filename
fhandle dw ? ; file handle
.
.
.
mov ah,68h ; function number
mov bx,fhandle ; file handle
int 21h ; transfer to MS-DOS
jc error ; jump if commit failed
.
.
.