Skip to Main Content United States    
PRODUCTS SUPPORT SOLUTIONS SERVICES
COMPAQ SOFTWARE
Compaq C

Compaq C
Run-Time Library Reference Manual for OpenVMS Systems


Previous Contents Index

Running this example produces the following result:


[A] is a member of the character class alnum 
[A] is a member of the character class alpha 
[A] is not a member of the character class cntrl 
[A] is not a member of the character class digit 
[A] is a member of the character class graph 
[A] is not a member of the character class lower 
[A] is a member of the character class print 
[A] is not a member of the character class punct 
[A] is not a member of the character class space 
[A] is a member of the character class upper 
[A] is a member of the character class xdigit 


wcwidth

Determines the number of printing positions on a display device required for the specified wide character.

Format

#include <wchar.h>

int wcwidth (wchar_t wc);


Arguments

wc

A wide character.

Description

This function determines the number of column positions needed for the specified wide character wc. The value of wc must be a valid wide character in the current locale.

Return Values

x The number of printing positions required for wc.
0 If wc is a null character.
--1 Indicates that wc does not represent a valid printing wide character.

wmemchr

Locates the first occurence of a specified wide character in an array of wide characters.

Format

#include <wchar.h>

wchar_t wmemchr (const wchar_t *s, wchar_t c, size_t n);

Function Variants This function also has variants named _wmemchr32 and _wmemchr64 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

s

A pointer to an array of wide characters to be searched.

c

The wide character value to search for.

n

The maximum number of wide characters in the array to be searched.

Description

This function locates the first occurrence of the specified wide character in the initial n wide characters of the array pointed to by s.

Return Values

x A pointer to the first occurrence of the wide character in the array.
NULL The specified wide character does not occur in the array.

wmemcmp

Compares two arrays of wide characters.

Format

#include <wchar.h>

int wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n);


Arguments

s1, s2

Pointers to wide-character arrays.

n

The maximum number of wide characters to be compared.

Description

This function compares the first n wide characters of the array pointed to by s1 with the first n wide characters of the array pointed to by s2. The wide characters are compared not according to locale-dependent collation rules, but as integral objects of type wchar_t .

Return Values

0 Arrays are equal.
Positive value The first array is greater than the second.
Negative value The first array is less than the second.

wmemcpy

Copies a specified number of wide characters from one wide-character array to another.

Format

#include <wchar.h>

wchar_t wmemcpy (wchar_t *dest, const wchar_t *source, size_t n);

Function Variants This function also has variants named _wmemcpy32 and _wmemcpy64 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

dest

A pointer to the destination array.

source

A pointer to the source array.

n

The number of wide characters to be copied.

Description

This function copies n wide characters from the array pointed to by source to the array pointed to by dest.

Return Values

x The value of dest.

wmemmove

Copies a specified number of wide characters from one wide-character array to another.

Format

#include <wchar.h>

wchar_t wmemmove (wchar_t *dest, const wchar_t *source, size_t n);

Function Variants This function also has variants named _wmemmove32 and _wmemmove64 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

dest

A pointer to the destination array.

source

A pointer to the source array.

n

The number of wide characters to be moved.

Description

This function copies n wide characters from the location pointed to by source to the location pointed to by dest.

The wmemmove and wmemcpy routines perform the same function, except that wmemmove ensures that the original contents of the source array are copied to the destination array even if the two arrays overlap. Where such overlap is possible, programs that require portability should use wmemmove , not wmemcopy .


Return Values

x The value of dest.

wmemset

Sets a specified value to a specified number of wide characters in an array of wide characters.

Format

#include <wchar.h>

wchar_t wmemset (wchar_t *s, wchar_t c, size_t n);

Function Variants This function also has variants named _wmemset32 and _wmemset64 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

s

A pointer to the array of wide characters.

c

The value to be placed in the first n wide characters of the array.

n

The number of wide characters to be set to the specified value c.

Description

This function copies the value of c into each of the first n wide characters of the array pointed to by s.

Return Values

x The value of s.

wprintf

Performs formatted output from the standard output (stdout). See Chapter 2 for information on format specifiers.

Format

#include <wchar.h>

int wprintf (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 resultant types correspond to conversion specifications given in the format specification.

If no conversion specifications are given, the output sources can be omitted. Otherwise, the function calls must have exactly as many output sources as there are conversion specifications, and the conversion specifications must match the types of the output sources.

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


Description

This function is equivalent to the fwprintf function with the stdout argument interposed before the wprintf arguments.

Return Values

n The number of wide characters written.
Negative value Indicates an error. The function sets errno to one of the following:
  • EILSEQ -- Invalid character detected.
  • EINVAL -- Insufficient arguments.
  • ENOMEM -- Not enough memory available for conversion.
  • ERANGE -- Floating-point calculations overflow.
  • EVMSERR -- Nontranslatable VMS error. vaxc$errno contains the VMS error code. This might indicate that conversion to a numeric value failed because of overflow.

The function can also set errno to the following as a result of errors returned from the I/O subsystem:

  • EBADF -- The file descriptor is not valid.
  • EIO -- I/O error.
  • ENOSPC -- No free space on the device containing the file.
  • ENXIO -- Device does not exist.
  • EPIPE -- Broken pipe.
  • ESPIPE -- Illegal seek in a file opened for append.
  • EVMSERR -- Nontranslatable VMS error. vaxc$errno contains the VMS error code. This indicates that an I/O error occurred for which there is no equivalent C error code.

wrapok

In the UNIX system environment, allows the wrapping of a word from the right border of the window to the beginning of the next line. This routine is provided only for UNIX software compatibility and serves no function in the OpenVMS environment.

Format

#include <curses.h>

wrapok (WINDOW *win, bool boolf);


Arguments

win

A pointer to the window.

boolf

A Boolean TRUE or FALSE value. If boolf is FALSE, scrolling is not allowed. This is the default setting. The bool type is defined in the <curses.h> header file as follows:


#define bool int 


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 <unistd.h>

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


Argument

filedes

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 filedes 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

This 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 ONLY)

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);


Argument

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.


Previous Next Contents Index
Buy Online or Call 1.800.888.0220      privacy statement and legal notices 
STORES CONTACT US SEARCH PRODUCTS SOLUTIONS OPTIONS DEVELOPERS