CREAT(3) BSD Library Functions Manual CREAT(3)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)STANDARDS
The creat() function call conforms to ISO/IEC 9945-1:1990 (``POSIX.1'').
HISTORY
The creat() function call appeared in Version 6 AT&T UNIX.
BSD June 2, 1993 BSD
Check Out this Related Man Page
CREAT(3P) POSIX Programmer's Manual CREAT(3P)PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond-
ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
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(3P)
I need to delete a certain data in a file. May I know how to do it by using awk, sed any shell command?
For example, i have a file details.dat. The user will search in that file for a particular field and if match, he will delete the whole record. Do you know how to do it? (21 Replies)
:cool: I like Vibhory2 like the idea of tapping into the kernel.. although not as indepth as he/she... i want to create a virtual databse of a few ma chines with connectivity and defiinte knowledge to create it.. I havebeen working on the project for a year now.. ! before unix (1 year exactly) i... (20 Replies)
Hi,
I am not sure how to start doing this so I hope to get some advice as to how to start.
I have 2 files. The source file contains data that I needed is in columns delimited by ";". For example, in this format:
"CONTINENT","COUNTRY","CITY","ID"
"asia","japan","tokyo","123"... (21 Replies)
Hello,
I am trying to write a script in Perl which will send some data from a UNIX Box to a windows box. I am planning to create a TCP/IP communication port for the same. How do I go about this? Kindly help.
Regards,
Garric (50 Replies)
Hi All,
I am very new in programming. I need some help.
I have one input file like:
Number of disabled taxa: 9
Loading mapping file: ncbi.map
Load mapping:
taxId2TaxLevel: 469951
--- Subsample reads (20%): 66680 of 334386
Processing: tree-from-summary
Running tree-from-summary... (21 Replies)
Hi,
I need to check some files in one directory whether any files has been created before 4 hours(ie, less than 4 hours from the current time).
Can anybody help me out..?
Thanks in advance..! (21 Replies)
Hi
I want create table based on csv file .I have come up with some informations getting columns names and then no idea from that
.Please any help
file.txt
col1|col2|col3|col4|col5
1234|zxxxx|xcvvv|300|null
file.sh
file=$1
c1=`head -1 $file|tr "|" "\n" |cat -n`
echo "$c1"... (31 Replies)
Hi
I need to create a user who can have access on only one folder.
for example I created a user "test" . he should have access only on folder
/testfolder.
The problem is that the user will mostly use FileZilla to ftp his files in the testfolder.
In the fileZilla , i want him to be... (21 Replies)
Hi all, I am brand new to these forums and I am a brand new UNIX Administartor. Don't know any scripting yet :wall:, and would like to learn as my boss is slowly letting me understand everything about being a Sys/*Nix Admin. He created this script which I am trying to replicate because I lost it... (54 Replies)
Guys I want to do this:
copy:
/var/router/system1/config/backup/install.put
/var/router/system2/config/backup/install.put
/var/router/system3/config/backup/install.put
/var/router/system4/config/backup/install.put
into:
/var/router/system1/config/install.dat... (22 Replies)
I have a function in bash script to create dir and subdir
function mkdir_stage ( )
{
mkdir -p /webdata/ecif/etl/$Env/$projectname/
mkdir -p /webdata/ecif/etl/$Env/$projectname/archivefiles
mkdir -p /webdata/ecif/etl/$Env/$projectname/dropbox
mkdir -p ... (40 Replies)
Hi,
I want to display latest files (created or modified) recursively in a path.
I tried in different ways, but didn't get any desired output:
find $path -type f -exec ls -lt {} \; | sort -n -r
find $path -type f -printf %p";" | xargs -d ";" ls -t
Second one is giving the error:... (21 Replies)
I wonder whether someone can help me with what I'm trying to achieve
Basically, the objective is one script to create new user on more than 70 linux hosts if required.
Everything works apart from the highlighted part. It gave me an output
passwd: Unknown user name ''. when try to set... (35 Replies)
Hi,
I'm a newbie to PowerVM and LPARs ( I work with VmWare and Oracle VM Server for Sparc) .recently we purchased an 8202-e4b server, with two enclosures for add'l disk capacity. it is licensed for PowerVM standard,came preloaded as such, AIX 7.1.
I've set up HMC v8.2, and run it through a VM on... (30 Replies)
Hello guys! I'm a newbee in Solaris systems.
There is an issue, that I've got:
I have to make an iso image of my solaris system.
How can I do it? with dd utility?
Clonezilla does not support spark, so it cant do backup.
pls help!
Is this solution:
Creating a Solaris Flash Archive... (21 Replies)