please dont rip this site
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 14:26, local time: 2024/4/21 01:39,

 ©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?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> INT 21f 40</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?


Welcome to!


Welcome to!