Function 40h Write To A File Or Device Write to file with handle entry AH 40h BX file handle CX number of bytes to write DS:DX address of buffer return flag CF 0 successful write 1 error AX number of bytes written or error code (5, 6) note 1) This call attempts to transfer the number of bytes indicated in CX from a buffer to a file. If CX and AX do not match after the write, an error has taken place; however no error code will be returned for this problem. This is usually caused by a full disk. 2) If the write is performed to STDOUT (handle 0001), it may be redirected 3) To truncate the file at the current position of the file pointer, set the number of bytes in CX to zero before calling int 21h. The pointer can be moved to any desired position with function 42h. 4) This function will not write to a file or device marked read-only. 5) May also be used to display strings to CON instead of fn 09h. This function will write CX bytes and stop; fn 09h will continue to write until a $ character is found. 6) This is the call that DOS actually uses to write to the screen in DOS 2.x and above. 7) for FAT32 drives, the file must have been opened with AX=6C00h with the "extended size" flag in order to expand the file beyond 2GB; otherwise the write will fail with error code 0005h (access denied) bugs a write of zero bytes will appear to succeed when it actually failed if the write is extending the file and there is not enough disk space for the expanded file (DOS 5.0-6.0); one should therefore check whether the file was in fact extended by seeking to 0 bytes from the end of the file (INT 21/AX=4202h/CX=0000h/DX=0000h) Attempting to read close to 64k of data in one chunk MAY result in data corruption near the end of the block when running under Window 98.
file: /Techref/INT/21f/40.htm, 1KB, , updated: 1999/6/14 13:26, local time: 2024/12/21 08:14,
13.59.0.25:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.org/techref/INT/21f/40.htm"> INT 21f 40</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to massmind.org! |
.