Name Syntax | creat, creat64 #include <fcntl.h> Optional int creat(const char *path, mode_t mode); BS2000 | |
Description | If POSIX files are created, the behavior of this function conforms to the XPG standard as described below:
If the file exists, its length is truncated to 0, and the mode and owner are unchanged. If the file does not exist, the file's owner ID is set to the effective user ID of the process. The group ID of the file is set to the effective group ID of the process, unless the If the group ID of the new file does not match the effective group ID or one of the supplementary group IDs, the All bits set in the process's file mode creation mask are cleared (see The 'save text image after execution bit' of the mode is cleared (see Upon successful completion, a write-only file descriptor is returned, and the file is opened for writing even if the mode does not permit writing. The file position indicator is set to the beginning of the file. The file descriptor is set to remain open across The call
There is no difference in functionality between BS2000 The following must be noted when creating BS2000 files: path can be:
mode: Only the lbp switch, the Nosplit switch, and the lbp switch The lbp switch controls handling of the Last Byte Pointer (LBP). It is only relevant for binary files with PAM access mode and can be combined with all specifications permissible for
When a file which has been newly created is closed, no marker is written and a valid LBP is set. In the case of NK files the last logical block is padded with binary zeros, in the case of K files the file is padded to the physical end of file.
When a file which has been newly created is closed, the LBP is set to zero (= invalid). A marker is written. In the case of NK files the last logical block is padded with binary zeros, in the case of K files the file is padded to the physical end of file.In the case of NK files the last logical block is padded with binary zeros, in the case of K files the file is padded to the physical end of file. If the lbp switch is specified in both variants ( If the lbp switch is not specified, the behavior depends on the environment variable LAST_BYTE_POINTER (see also section “Environment variables”):
The function behaves as if
The function behaves as if Nosplit switch This switch controls the processing of text files with SAM access mode and variable record length when a maximum record length is also specified. It can be combined with any of the other constants.
When writing with If the switch is not specified, the following applies when writing: A record which is longer than the maximum record length will be split into multiple records. If a record has precisely the maximum record length, a record of the length zero is written after it. The constant
This switch functions as follows: The The BS2000 file name or link name may be written in lowercase and uppercase letters. It is automatically converted to uppercase letters. If the file does not exist, the following file is created by default: When using a link name, the following file attributes can be changed by means of the If an existing file is truncated to length 0, the catalog attributes of the file are preserved. A maximum of | |
Return val. | File descriptor | |
if successful. | ||
-1 | if an error occurs. | |
Errors |
| |
|
| Search permission is denied on a component of the path. The file does not exist and the directory in which the file is to be created does not permit writing. The file exists and write permission is denied. |
| Extension | |
|
| The file exists, mandatory file/record locking is set, and there are outstanding record locks on the file (see |
|
|
|
| Extension | |
|
| path points outside the allocated address space of the process. (End) |
|
| A signal was caught during the |
|
| The specified file is a directory. |
| Extension | |
|
| Too many symbolic links were encountered in resolving path. |
|
| The process has too many open files (see |
|
| |
The length of the path argument exceeds | ||
|
| The system file table is full. |
| A component of the pathname does not exist or path points to an empty string. | |
| The file system is out of inodes. | |
| A component of the pathname is not a directory. | |
| The named file is a character special or block special file, and the device associated with this special file does not exist. | |
| The specified file resides or would reside on a read-only file system. | |
| The file is a pure program file that is currently being executed. | |
Notes | The program environment determines whether a BS2000 or POSIX file is created. | |
See also |
|