basic.%creat

C Function/BASIC Program, Releases: AP/Unix

Creates new Unix file, or rewrites to existing file.

Syntax

file.descriptor=%creat(string, mode)

Description

creates a new ordinary Unix file or prepares to rewrite an existing Unix file designated by 'string' for write only. 'mode' controls the file mode. Valid values of 'mode' are in the include 'mode.h'. Combinations of the modes are obtained by adding several elementary modes together.

Example

include dm,bp,unix.h mode.h

* Create a unique temporary file
* read and write permission for user,
* read for group
fd=%creat( '/tmp/':system(19),
S$IRUSR+S$IWUSR+S$IRGRP)

Note the usage of the plus operator to combine flags, where a regular C program
would have used an 'or'.

See Also

Command Name Type Description
basic.%read C Function Reads from a Unix file.
basic.%write C Function Writes to a Unix file.
basic.cfunc Definition can be called from a Pick/BASIC program or subroutine in AP/DOS and AP/Unix implementations using a syntax similar to that of normal C.
basic.cfunction Definition Declare a list of C functions.
basic.%whex C Function Writes to a Unix file, converting into binary.
basic.%rdhex C Function Reads a Unix file and translates to hexadecimal.
basic.%close C Function Closes a Unix file.
basic.%unlink C Function Removes a directory entry.
basic.%fsize C Function Gets the size of a file.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.