home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
FDF101.ZIP
/
ELIB.ZOO
/
delete.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-30
|
495b
|
25 lines
#include <sys/stat.h>
/*
* delete_file
*
* given the name of a file, attempt to delete it and return zero on success,
* non-zero if not. 'force' parameter, if non-zero, will try to change the
* mode of a file from read-only to delete it.
*/
int delete_file(char *file, char force)
{
if (force) {
struct stat statbuf;
if ((!stat(file, &statbuf)) && (!(statbuf.st_mode & S_IWRITE)))
chmod(file, statbuf.st_mode | S_IWRITE);
}
return unlink(file);
}