Date: Sun, 14 Sep 1997 17:55:35 +0300 (IDT) From: Eli Zaretskii To: Vik Heyndrickx cc: djgpp AT delorie DOT com Subject: Re: '_write'-ing 0 bytes In-Reply-To: <34192383.BED@rug.ac.be> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Fri, 12 Sep 1997, Vik Heyndrickx wrote: > When _write is called with a count of 0, the file gets truncated. Is > this POSIX behaviour? `_write' is not a POSIX function, so this has nothing to do with what POSIX rules. The corresponding POSIX function is `write', and its DJGPP version does in fact return without doing anything when count is zero. The DOS function which `_write' calls is documented to truncate the file when a zero count is passed to it. For example, here's the relevant fragment from ralf Brown's Interrupt List: --------D-2140------------------------------- INT 21 - DOS 2+ - "WRITE" - WRITE TO FILE OR DEVICE AH = 40h BX = file handle CX = number of bytes to write DS:DX -> data to write Return: CF clear if successful AX = number of bytes actually written CF set on error AX = error code (05h,06h) (see #1332 at AH=59h/BX=0000h) Notes: if CX is zero, no data is written, and the file is truncated or extended to the current position