#include <fcntl.h> int aopen(const char *name, int flags, const char *amparms);
aopen
is a variant of open
. It enables you to open a
file for UNIX style I/O while specifying access method parameters
(amparms) to request 370-dependent options.
The name
argument is the external name (sometimes called
pathname) of the file to be opened. Its form depends on the operating
system. If name
is an HFS file, the file is not opened
directly. The file is opened through standard I/O as though it were
an MVS file because aopen
is used to specify amparms. OpenEdition does
not support amparms. This should be a rare occurrence because
there is little reason to call aopen
for an HFS file.
The flags
argument is a bit string formed by ORing option bits. The
bits are defined symbolically, and the header file <fcntl.h>
should be
included to obtain their definitions. The flags and their meanings are as
follows:
O_RDONLY
O_WRONLY
O_RDWR
O_APPEND
O_CREAT
O_TRUNC
O_EXCL
O_TEXT
O_BINARY
O_NONBLOCK
O_NOCTTY
You should only set one of the following options: O_RDONLY
,
O_WRONLY
, or O_RDWR
. O_EXCL
is ignored if O_CREAT
is not also set. If neither O_TEXT
nor O_BINARY
is specified,
O_BINARY
is assumed unless the file to be opened is the terminal.
The amparms
argument is a string specifying access method parameters,
which are system- and access-method-dependent file processing options.
See Open modes for more information on details of the filename, open mode, and amparms specifications.
aopen
returns the file number of the file that was opened. If it fails,
aopen
returns - 1.
aopen
and files opened with open
interchangeably. The name
and mode
arguments to aopen
have the same meanings and formats as the corresponding open
arguments.
aopen(name, mode, "")
is equivalent to open(name, mode)
.
#include <fcntl.h> #include <stdlib.h> main() { int cardfd; char ending = '.'; /* Open a card-image file. */ cardfd = aopen("tso:cards.out", O_WRONLY | O_CREAT | O_TRUNC, "recfm=f,reclen=80"); if (cardfd < 0) exit(EXIT_FAILURE); lseek(cardfd, 7999, SEEK_SET); /* Write a '.' in position 7999. Previous positions */ /* will be filled with nulls. */ write(&ending, cardfd, 1); close(cardfd); exit(EXIT_SUCCESS); }
afopen
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.