cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/14/14:57:16

Date: Sun, 14 Sep 1997 17:55:35 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
cc: djgpp AT delorie DOT com
Subject: Re: '_write'-ing 0 bytes
In-Reply-To: <34192383.BED@rug.ac.be>
Message-ID: <Pine.SUN.3.91.970914175500.20228B-100000@is>
MIME-Version: 1.0

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019