[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP C
Run-Time Library Reference Manual for OpenVMS Systems


Previous Contents Index


write

Writes a specified number of bytes from a buffer to a file.

Format

#include <unistd.h>

ssize_t write (int file_desc, void *buffer, size_t nbytes); (ISO POSIX-1)

int write (int file_desc, void *buffer, int nbytes); (COMPATABILITY)


Arguments

file_desc

A file descriptor that refers to a file currently opened for writing or updating.

buffer

The address of contiguous storage from which the output data is taken.

nbytes

The maximum number of bytes involved in the write operation.

Description

If the write is to an RMS record file and the buffer contains embedded new-line characters, more than one record may be written to the file. Even if there are no embedded new-line characters, if nbytes is greater than the maximum record size for the file, more than one record will be written to the file. The write function always generates at least one record.

If the write is to a mailbox and the third argument, nbytes, specifies a length of 0, an end-of-file message is written to the mailbox. This occurs for mailboxes created by the application using SYS$CREMBX, but not for mailboxes created to implement POSIX pipes. For more information, see Chapter 5.


Return Values

x The number of bytes written.
- 1 Indicates errors, including undefined file descriptors, illegal buffer addresses, and physical I/O errors.

writev

Writes to a file.

Format

#include <uio.h>

ssize_t writev (int file_desc, const struct iovec *iov, int iovcnt);

ssize_t __writev64 (int file_desc, const struct __iovec64 *iov, int iovcnt); (ALPHA, I64)

Function Variants The writev function has variants named _writev32 and __writev64 for use with 32-bit and 64-bit pointer sizes, respectively. See Section 1.10 for more information on using pointer-size-specific functions.

Arguments

file_desc

A file descriptor that refers to a file currently opened for writing or updating.

iov

Array of iovec structures from which the output data is gathered.

iovcnt

The number of buffers specified by the members of the iov array.

Description

The writev function is equivalent to write but gathers the output data from the iovcnt buffers specified by the members of the iov array: iov[0], iov[1], ..., iov[iovcnt - 1]. The iovcnt argument is valid if greater than 0 and less than or equal to {IOV_MAX}, defined in <limits.h> .

Each iovec entry specifies the base address and length of an area in memory from which data should be written. The writev function writes a complete area before proceeding to the next.

If filedes refers to a regular file and all of the iov_len members in the array pointed to by iov are 0, writev returns 0 and has no other effect.

For other file types, the behavior is unspecified.

If the sum of the iov_len values is greater than SSIZE_MAX, the operation fails and no data is transferred.

Upon successful completion, writev returns the number of bytes actually written. Otherwise, it returns a value of - 1, the file pointer remains unchanged, and errno is set to indicate an error.


Return Values

x The number of bytes written.
- 1 Indicates an error. The file times do not change, and the function sets errno to one of the following values:
  • EBADF -- The file_desc argument is not a valid file descriptor open for writing.
  • EINTR -- The write operation was terminated due to the receipt of a signal, and no data was transferred.
  • EINVAL -- The sum of the iov_len values in the iov array would overflow an ssize_t , or the iovcnt argument was less than or equal to 0, or greater than {IOV_MAX}.
  • EIO -- A physical I/O error has occurred.
  • ENOSPC -- There was no free space remaining on the device containing the file.
  • EPIPE -- An attempt is made to write to a pipe or FIFO that is not open for reading by any process, or that only has one end open. A SIGPIPE signal will also be sent to the thread.

wscanf

Reads input from the standard input ( stdin ) under control of the wide-character format string.

Format

#include <wchar.h>

int wscanf (const wchar_t *format, ...);


Arguments

format

A pointer to a wide-character string containing the format specifications. For more information about format and conversion specifications and their corresponding arguments, see Chapter 2.

...

Optional expressions whose results correspond to conversion specifications given in the format specification.

If no conversion specifications are given, you can omit the input pointers. Otherwise, the function calls must have exactly as many input pointers as there are conversion specifications, and the conversion specifications must match the types of the input pointers.

Conversion specifications are matched to input sources in left-to-right order. Excess input pointers, if any, are ignored.


Description

The wscanf function is equivalent to the fwscanf function with the stdin arguments interposed before the wscanf arguments.

Return Values

n The number of input items assigned. The number can be less than provided for, even zero, in the event of an early matching failure.
EOF Indicates an error. An input failure occurred before any conversion.

y0, y1, yn (ALPHA, I64)

Compute Bessel functions of the second kind.

Format

#include <math.h>

double y0 (double x);

float y0f (float x);

long double y0l (long double x);

double y1 (double x);

float y1f (float x);

long double y1l (long double x);

double yn (int n, double x);

float ynf (int n, float x);

long double ynl (int n, long double x);


Arguments

x

A positive, real value.

n

An integer.

Description

The y0 functions return the value of the Bessel function of the second kind of order 0.

The y1 functions return the value of the Bessel function of the second kind of order 1.

The yn functions return the value of the Bessel function of the second kind of order n.


Return Values

x The relevant Bessel value of x of the second kind.
- HUGE_VAL The x argument is 0.0; errno is set to ERANGE.
NaN The x argument is negative or NaN; errno is set to EDOM.
0 Underflow occurred; errno is set to ERANGE.
HUGE_VAL Overflow occurred; errno is set to ERANGE.


Appendix A
Version-Dependency Tables

New functions are added to the HP C Run-Time Library with each version of HP C. These functions are implemented and shipped with the OpenVMS operating system, while the documentation and header files containing their prototypes are shipped with versions of the HP C compiler.

You might have a newer version of HP C that has header files and documentation for functions that are not supported on your older OpenVMS system. For example, if your target operating system platform is OpenVMS Version 7.2, you cannot use HP C RTL functions introduced on OpenVMS Version 7.3, even though they are documented in this manual.

This appendix contains several tables that list what HP C RTL functions are supported on recent OpenVMS versions. This is helpful for determining the functions to avoid using on your target OpenVMS platforms.

A.1 Functions Available on all OpenVMS VAX, Alpha, and I64 Versions

Table A-1 lists functions available on all OpenVMS VAX and OpenVMS Alpha versions.

Table A-1 Functions Available on All OpenVMS Systems
abort abs access acos
alarm asctime asin assert
atan2 atan atexit atof
atoi atoll (Alpha) atol atoq (Alpha)
box brk bsearch cabs
calloc ceil cfree chdir
chmod chown clearerr clock
close cosh cos creat
ctermid ctime cuserid decc$crtl_init
decc$fix_time decc$from_vms decc$match_wild decc$record_read
decc$record_write decc$set_reentrancy decc$to_vms decc$translate_vms
delete delwin difftime div
dup2 dup ecvt endwin
execle execlp execl execve
execvp execv exit _exit
exp fabs fclose fcvt
fdopen feof ferror fflush
fgetc fgetname fgetpos fgets
fileno floor fmod fopen
fprintf fputc fputs fread
free freopen frexp fscanf
fseek fsetpos fstat fsync
ftell ftime fwait fwrite
gcvt getchar getcwd getc
getegid getenv geteuid getgid
getname getpid getppid gets
getuid getw gmtime gsignal
hypot initscr isalnum isalpha
isapipe isascii isatty iscntrl
isdigit isgraph islower isprint
ispunct isspace isupper isxdigit
kill labs ldexp ldiv
llabs (Alpha) lldiv (Alpha) localeconv localtime
log10 log longjmp longname
lseek lwait malloc mblen
mbstowcs mbtowc memchr memcmp
memcpy memmove memset mkdir
mktemp mktime modf mvwin
mv[w]addstr newwin nice open
overlay overwrite pause perror
pipe pow printf putchar
putc puts putw qabs (Alpha)
qdiv (Alpha) qsort raise rand
read realloc remove rename
rewind sbrk scanf scroll
setbuf setgid setjmp setlocale
setuid setvbuf sigblock signal
sigpause sigstack (VAX) sigvec sinh
sin sleep sprintf sqrt
srand sscanf ssignal stat
strcat strchr strcmp strcoll
strcpy strcspn strerror strftime
strlen strncat strncmp strncpy
strpbrk strrchr strspn strstr
strtod strtok strtoll (Alpha) strtol
strtoq (Alpha) strtoull (Alpha) strtoul strtouq (Alpha)
strxfrm subwin system tanh
tan times time tmpfile
tmpnam toascii tolower _tolower
touchwin toupper _toupper ttyname
umask ungetc vaxc$calloc_opt vaxc$cfree_opt
vaxc$crtl_init vaxc$establish vaxc$free_opt vaxc$malloc_opt
vaxc$realloc_opt va_arg va_count va_end
va_start va_start_1 vfork vfprintf
vprintf vsprintf wait wcstombs
wctomb write [w]addch [w]addstr
[w]clear [w]clrattr [w]clrtobot [w]clrtoeol
[w]delch [w]deleteln [w]erase [w]getch
[w]getstr [w]inch [w]insch [w]insertln
[w]insstr [w]move [w]printw [w]refresh
[w]scanw [w]setattr [w]standend [w]standout

A.2 Functions Available on OpenVMS Version 6.2 and Higher

Table A-2 lists functions available on OpenVMS VAX and OpenVMS Alpha Version 6.2 and higher.

Table A-2 Functions Added in OpenVMS Version 6.2
catclose catgets catopen fgetwc
fgetws fputwc fputws getopt
getwc getwchar iconv iconv_close
iconv_open iswalnum iswalpha iswcntrl
iswctype iswdigit iswgraph iswlower
iswprint iswpunct iswspace iswupper
iswxdigit nl_langinfo putwc putwchar
strnlen strptime towlower towupper
ungetwc wcscat wcschr wcscmp
wcscoll wcscpy wcscspn wcsftime
wcslen wcsncat wcsncmp wcsncpy
wcspbrk wcsrchr wcsspn wcstol
wcstoul wcswcs wcswidth wcsxfrm
wcstod wctype wcwidth wcstok


Previous Next Contents Index