home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff319.lzh
/
CNewsSrc
/
cnews.orig.lzh
/
libusg
/
fopenexcl.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-27
|
383b
|
21 lines
/*
* fopenexcl(name) - fopen(name, "w") with error if name exists (USG)
*/
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
FILE *
fopenexcl(name)
register char *name;
{
/* This is the cheaper way. */
register int fd = open(name, O_WRONLY|O_CREAT|O_EXCL, 0666);
if (fd < 0)
return NULL; /* name existed or couldn't be made */
else
return fdopen(fd, "w");
}