Message-ID: <33BCF059.5254@xs4all.nl> Date: Fri, 04 Jul 1997 14:45:14 +0200 From: "GRANULAB international B.V." MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: remove doesn't delet a file Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk I have problems using the remove function. Here a sample of my code: _creat(datafile,0x00); fd = _open(datafile,O_WRONLY); .... /* ask user for file input, and write to file using _write() */ if(_close(fd)!=0) printf("Error using closing file"); /* get filesize of datafile */ fp_filesize = fopen(datafile,"rb"); filesize = filelength(fileno(fp_filesize)); fclose(fp_filesize); /* delete file if there is no data in it */ if (filesize == 0) { error = remove(datafile); printf(datafile,"%xd",error); } The function _close doesn't give an error message. If no data is written to the file, the remove function doesn't remove the file. The error code is 0xFFFFFFFD. When instead of _create(), _open(), _close() and _write the functions fopen(), fclose() and fwrite are used then the remove function works right. Richard