delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/07/05:30:41

Date: Mon, 7 Jul 1997 12:28:34 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "GRANULAB international B.V." <granulab AT xs4all DOT nl>
cc: djgpp AT delorie DOT com
Subject: Re: remove doesn't delet a file
In-Reply-To: <33BCF059.5254@xs4all.nl>
Message-ID: <Pine.SUN.3.91.970707122808.10192P-100000@is>
MIME-Version: 1.0

On Fri, 4 Jul 1997, GRANULAB international B.V. wrote:

> I have problems using the remove function. Here a sample of my code:

Your example (slightly modified to make it compile) works for me, both
when no data is written and when some data is written to the file.
Please post the shortest complete program that exhibits the problem.

>     _creat(datafile,0x00);
>     fd = _open(datafile,O_WRONLY);

The call to `_open' is unnecessary, since `_creat' also opens the
file.  The way you've done it, you waste a file handle, and also
remove the file while it is still open, which on MS-DOS just invites
trouble.

>     	printf(datafile,"%xd",error);

This is wrong.  You probably wanted to say this:

	printf("%xd", error);

I would also recommend against printing error codes with "%x", because
"%x" converts the code to unsigned.

- Raw text -


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