Note: This API call is for DOS and Win16 personality only. Use Family API for portability.
2 and higher
“WRITE” - WRITE TO FILE OR DEVICE
AH = 40h BX = file handle CX = number of bytes to write DS:DX -> data to write
CF clear if successful
AX = number of bytes actually written CF set on error AX = error code (05h,06h) (see #01680 at AH=59h/BX=0000h)
if CX is zero, no data is written, and the file is truncated or extended to the current position
data is written beginning at the current file position, and the file position is updated after a successful write
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)
the usual cause for AX < CX on return is a full disk
BUG: 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)
under the FlashTek X-32 DOS extender, the pointer is in DS:EDX
Text based on Ralf Brown Interrupt List Release 61
osFree Macro Library | |
---|---|
Video I/O | @SetMode @SetCurSz @SetCurPos @GetCur @SetPage @ScrollUp @ScrollDn @Scroll @GetChAtr @PutChAtr @PutCh @SetPalet @SetColor @SetDot @GetDot @WrtTTY @VideoState @GetMode @GetDisplay @GetVideoState @GetEGAInfo @Cls |
Hardware info | @Equipment @MemSize |
Serial I/O | @AuxInit @AuxSendChar @AuxRecieveChar @AuxStatus |
Tape I/O | @TapeOn @TapeOff @TapeRead @TapeWrite |
Keyboard I/O | @KbdStatus @CharIn @CharPeek |
Printer I/O | @PrnPrint @PrnInit @PrnStatus |
Disk I/O | @DskReset @DskStatus @DskRead @DskWrite @DskVerify @DskFormat |
Date and Time | @SetTime @GetTime |
Mouse | @MouInit @MouShowPointer @MouStatus @MouSetPos @MouSetMickey @MouRegion |
Memory manager | @ModBlok SET_BLOCK |