02-28-2001
From the creat(2) man page:
Quote:
CREAT(2) FreeBSD System Calls Manual CREAT(2)
NAME
creat - create a new file
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <fcntl.h>
int
creat(const char *path, mode_t mode)
DESCRIPTION
This interface is made obsolete by: open(2).
Creat() is the same as:
open(path, O_CREAT | O_TRUNC | O_WRONLY, mode);
SEE ALSO
open(2)
HISTORY
The creat() function call appeared in Version 6 AT&T UNIX.
4th Berkeley Distribution June 2, 1993 1
So, it looks like you should be using open() instead.
Also, the #define you are trying to use is S_IWRITE, not _S_IWRITE. It is in sys/stat.h
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am on AOL now,and i am using 56 k,i was gonna install FreeBSD,but i dont know if aol works on BSD,or my modem.
Do they work on BSD? (2 Replies)
Discussion started by: kita
2 Replies
2. UNIX for Dummies Questions & Answers
i am new at unix and am VERY confused about the compression processes. what progs do i need to unzip and zip files? there must be a standard one similar to winzip? (1 Reply)
Discussion started by: Mindscan
1 Replies
3. UNIX for Dummies Questions & Answers
What is FreeBSD, who does use Free? (3 Replies)
Discussion started by: cyberangel
3 Replies
4. BSD
I want someone tell me the positives and negatives points of FreeBSD 5.2.1, if someone help me, i thanks a lot! (4 Replies)
Discussion started by: israel
4 Replies
5. BSD
B]I want the best of the best FreeBSD version for my study in Unix...please sugest me... Thanks (5 Replies)
Discussion started by: israel
5 Replies
6. BSD
I just download the FreeBSD 5.3 i386 iso files. And I have a problem now, I can't copy the 5.3-RELEASE-i386-disc2.iso to the cd, I try a lot of times, even change lots of blank cd to try but still cannot. But I can copy the other three iso files, i.e. 5.3-RELEASE-i386-bootonly.iso,... (4 Replies)
Discussion started by: GarbageKing
4 Replies
7. BSD
Hi to all,
Iam doing a project in Free BSD and i am stuck with a puzzle. Please any one of you clarify my doubt :
How to add a mechanism to check the status of the file system which alerts the root user via. email if any single partition is greater than 90% full. This alert should include the... (3 Replies)
Discussion started by: tadakamalla
3 Replies
8. Programming
Hello there,
My mulithreaded application (which is too large to represent the source code here) is crashing after installing FreeBSD 7.1-RELEASE/amd64.
It worked properly on others machines (Dual Cores with 4GB of RAM - FreeBSD 6.2-RELEASE/i386).
The current machine has 2x Core 2 Duo... (1 Reply)
Discussion started by: Seenquev
1 Replies
9. Fedora
I'm using Windows mostly and the only *nix thing I used during my life was cygwin (I like command line :)).
But currently I have (by an occasion) a DVD with latest FreeBSD. I don't know why, but I want to install it...
But probably, this OS is too difficult for a beginner. I heard, it's used on... (3 Replies)
Discussion started by: TeenageWerewolf
3 Replies
CREAT(P) POSIX Programmer's Manual CREAT(P)
NAME
creat - create a new file or rewrite an existing one
SYNOPSIS
#include <sys/stat.h>
#include <fcntl.h>
int creat(const char *path, mode_t mode);
DESCRIPTION
The function call:
creat(path, mode)
shall be equivalent to:
open(path, O_WRONLY|O_CREAT|O_TRUNC, mode)
RETURN VALUE
Refer to open() .
ERRORS
Refer to open() .
The following sections are informative.
EXAMPLES
Creating a File
The following example creates the file /tmp/file with read and write permissions for the file owner and read permission for group and oth-
ers. The resulting file descriptor is assigned to the fd variable.
#include <fcntl.h>
...
int fd;
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
char *filename = "/tmp/file";
...
fd = creat(filename, mode);
...
APPLICATION USAGE
None.
RATIONALE
The creat() function is redundant. Its services are also provided by the open() function. It has been included primarily for historical
purposes since many existing applications depend on it. It is best considered a part of the C binding rather than a function that should be
provided in other languages.
FUTURE DIRECTIONS
None.
SEE ALSO
open() , the Base Definitions volume of IEEE Std 1003.1-2001, <fcntl.h>, <sys/stat.h>, <sys/types.h>
COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol-
ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE
and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained
online at http://www.opengroup.org/unix/online.html .
IEEE
/The Open Group 2003 CREAT(P)