HP C
Run-Time Library Reference Manual for OpenVMS Systems


Previous Contents Index


vfwscanf

Reads input from the stream under control of a wide-character format string.

Format

#include <wchar.h>

int vfwscanf (FILE *stream, const wchar_t *format, va_list ap);


Arguments

stream

A file pointer.

format

A pointer to a wide-character string containing the format specifications.

ap

A list of expressions whose resultant types correspond to the conversion specifications given in the format specifications.

Description

The vfwscanf function is equivalent to the fwscanf function, except that instead of being called with a variable number of arguments, it is called with an argument list (ap) that has been initialized by va_start (and possibly with subsequent va_arg calls).

If the stream pointed to by stream has no orientation, vfwscanf makes the stream wide-oriented.

For more information about format and conversion specifications and their corresponding arguments, see Chapter 2.


Return Values

n The number of successfully matched and assigned wide-character input items.
EOF Indicates that a read error occurred before any conversion. The function sets errno . For a list of the values set by this function, see vfscanf .

vprintf

Prints formatted output based on an argument list.

This function is the same as the printf function except that instead of being called with a variable number of arguments, it is called with an argument list that has been initialized by the va_start macro (and possibly with subsequent va_arg calls) from <stdarg.h> .


Format

#include <stdio.h>

int vprintf (const char *format, va_list ap);


Arguments

format

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

ap

A variable list of the items needed for output.

Description

See the vfprintf and vsprintf functions.

Return Values

x The number of bytes written.
Negative value Indicates an output error. The function sets errno . For a list of possible errno values set, see fprintf .

vscanf

Reads formatted input based on an argument list.

Format

#include <stdio.h>

int vscanf (const char *format, va_list ap);


Arguments

format

A pointer to the string containing the format specification.

ap

A list of expressions whose resultant types correspond to the conversion specifications given in the format specifications.

Description

The vscanf function is the same as the scanf function except that instead of being called with a variable number of arguments, it is called with an argument list (ap) that has been initialized by the va_start macro (and possibly with subsequent va_arg calls).

For more information about format and conversion specifications and their corresponding arguments, see Chapter 2.

See also scanf , vfscanf , and vsscanf .


Return Values

n The number of successfully matched and assigned input items.
EOF Indicates that a read error occurred before any conversion. The function sets errno . For a list of the values set by this function, see vfscanf .

vsnprintf (ALPHA, I64)

Prints formatted output based on an argument list.

Format

#include <stdio.h>

int vsnprintf (char *str, size_t n, const char *format, va_list ap);


Arguments

str

A pointer to a string that will receive the formatted output.

format

A pointer to a character string that contains the format specification. For more information about format and conversion specifications and their corresponding arguments, see Chapter 2.

ap

A list of expressions whose resultant types correspond to the conversion specifications given in the format specifications.

Description

The vsnprintf function is the same as the snprintf function, but instead of being called with a variable number of arguments, it is called with an argument list that has been initialized by va_start (and possibly with subsequent va_arg calls).

This function does not invoke the va_end macro. Because the function invokes the va_arg macro, the value of ap after the return is unspecified.

Applications using vsnprintf should call va_end (ap) afterwards to clean up.


Return Values

x The number of bytes (excluding the terminating null byte) that would be written to str if n is sufficiently large.
Negative value Indicates an output error occurred. The function sets errno . For a list of possible errno values set, see fprintf .

vsprintf

Prints formatted output based on an argument list.

This function is the same as the sprintf function except that instead of being called with a variable number of arguments, it is called with an argument list that has been initialized by va_start (and possibly with subsequent va_arg calls).


Format

#include <stdio.h>

int vsprintf (char *str, const char *format, va_list ap);


Arguments

str

A pointer to a string that will receive the formatted output. This string is assumed to be large enough to hold the output.

format

A pointer to a character string that contains the format specification. For more information about format and conversion specifications and their corresponding arguments, see Chapter 2.

ap

A list of expressions whose resultant types correspond to the conversion specifications given in the format specifications.

Return Value

x The number of bytes written.
Negative value Indicates an output error occurred. The function sets errno . For a list of possible errno values set, see fprintf .

vsscanf

Reads formatted input based on an argument list.

Format

#include <stdio.h>

int vsscanf (char *str, const char *format, va_list ap);


Arguments

str

The address of the character string that provides the input text to sscanf .

format

A pointer to a character string that contains the format specification.

ap

A list of expressions whose resultant types correspond to the conversion specifications given in the format specifications.

Description

The vsscanf function is the same as the sscanf function except that instead of being called with a variable number of arguments, it is called with an argument list that has been initialized by va_start (and possibly with subsequent va_arg calls).

The vsscanf function is also equivalent to the vfscanf function, except that the first argument specifies a wide-character string rather than a stream. Reaching the end of the wide-character string is the same as encountering EOF for the vfscanf function.

For more information about format and conversion specifications and their corresponding arguments, see Chapter 2.

See also vsscanf and sscanf .


Return Values

n The number of successfully matched and assigned input items.
EOF Indicates that a read error occurred before any conversion. The function sets errno . For a list of the values set by this function, see vfscanf .

vswprintf

Writes output to the stream under control of the wide-character format string.

Format

#include <wchar.h>

int vswprintf (wchar_t *s, size_t n, const wchar_t *format, va_list ap);


Arguments

s

A pointer to a multibyte character sequence.

n

The maximum number of bytes that comprise the multibyte character.

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.

ap

A variable list of the items needed for output.

Description

The vswprintf function is equivalent to the swprintf function, with the variable argument list replaced by the ap argument. Initialize ap with the va_start macro, and possibly with subsequent va_arg calls.

See also swprintf .


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 OpenVMS error. vaxc$errno contains the OpenVMS 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 OpenVMS error. vaxc$errno contains the OpenVMS error code. This indicates that an I/O error occurred for which there is no equivalent C error code.

vswscanf

Reads input from the stream under control of the wide-character format string.

Format

#include <wchar.h>

int vswscanf (wchar_t *s, const wchar_t *format, va_list ap);


Arguments

s

A pointer to a wide-character string from which the input is to be obtained.

format

A pointer to a wide-character string containing the format specifications.

ap

A list of expressions whose results correspond to conversion specifications given in the format specification.

Description

The vswscanf function is equivalent to the swscanf function, except that instead of being called with a variable number of arguments, it is called with an argument list (ap) that has been initialized by va_start (and possibly with subsequent va_arg calls).

The vswscanf function is also equivalent to the vfwscanf function, except that the first argument specifies a wide-character string rather than a stream. Reaching the end of the wide-character string is the same as encountering EOF for the vfwscanf function.

For more information about format and conversion specifications and their corresponding arguments, see Chapter 2.

See also vfwscanf and swscanf .


Return Values

n The number of wide characters read.
EOF Indicates that a read error occurred before any conversion. The function sets errno . For a list of the values set by this function, see vfscanf .

vwprintf

Writes output to an array of wide characters under control of the wide-character format string.

Format

#include <wchar.h>

int vwprintf (const wchar_t *format, va_list ap);


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.

ap

The variable list of items needed for output.

Description

The vwprintf function is equivalent to the wprintf function, with the variable argument list replaced by the ap argument. Initialize ap with the va_start macro, and possibly with subsequent va_arg calls. The vwprintf function does not invoke the va_end macro.

See also wprintf .


Return Values

x The number of wide characters written, not counting the terminating null wide character.
Negative value Indicates an error. Either n or more wide characters were requested to be written, or a conversion error occurred, in which case errno is set to EILSEQ.

vwscanf

Reads input from an array of wide characters under control of a wide-character format string.

Format

#include <wchar.h>

int vwscanf (const wchar_t *format, va_list ap);


Arguments

format

A pointer to a wide-character string containing the format specifications.

ap

A list of expressions whose resultant types correspond to the conversion specifications given in the format specifications.

Description

The vwscanf function is equivalent to the wscanf function, except that instead of being called with a variable number of arguments, it is called with an argument list (ap) that has been initialized by va_start (and possibly with subsequent va_arg calls).

For more information about format and conversion specifications and their corresponding arguments, see Chapter 2.

See also wscanf .


Return Values

n The number of wide characters read.
EOF Indicates that a read error occurred before any conversion. The function sets errno . For a list of the values set by this function, see vfscanf .

wait

Checks the status of the child process before exiting. A child process is terminated when the parent process terminates.

Format

#include <wait.h>

pid_t wait (int *status);


Argument

status

The address of a location to receive the final status of the terminated child. The child can set the status with the exit function and the parent can retrieve this value by specifying status.

Description

The wait function suspends the parent process until the final status of a terminated child is returned from the child.

On OpenVMS Version 7.0 and higher systems, the wait function is equivalent to waitpid( 0, status, 0 ) if you include <wait.h> and compile with the _POSIX_EXIT feature-test macro set (either with /DEFINE=_POSIX_EXIT or with #define _POSIX_EXIT at the top of your file, before any file inclusions).


Return Values

x The process ID (PID) of the terminated child. If more than one child process was created, wait will return the PID of the terminated child that was most recently created. Subsequent calls will return the PID of the next most recently created, but terminated, child.
- 1 No child process was spawned.

wait3

Waits for a child process to stop or terminate.

Format

#include <wait.h>

pid_t wait3 (int *status_location, int options, struct rusage *resource_usage);


Arguments

status_location

A pointer to a location that contains the termination status of the child process as defined in the <wait.h> header file.

Beginning with OpenVMS Version 7.2, when compiled with the _VMS_WAIT macro defined, the wait3 function puts the OpenVMS completion code of the child process at the address specified in the status_location argument.

options

Flags that modify the behavior of the function. These flags are defined in the Description section.

resource_usage

The location of a structure that contains the resource utilization information for terminated child processes.

Description

The wait3 function suspends the calling process until the request is completed, and redefines it so that only the calling thread is suspended.

The options argument modifies the behavior of the function. You can combine the flags for the options argument by specifying their bitwise inclusive OR. The flags are:
WNOWAIT Specifies that the process whose status is returned in status_location is kept in a waitable state. You can wait for the process again with the same results.
WNOHANG Prevents the suspension of the calling process. If there are child processes that stopped or terminated, one is chosen and the waitpid function returns its process ID, as when you do not specify the WNOHANG flag. If there are no terminated processes (that is, if waitpid suspends the calling process without the WNOHANG flag), 0 (zero) is returned. Because you can never wait for process 0, there is no confusion arising from this return.
WUNTRACED Specifies that the call return additional information when the child processes of the current process stop because the child process received a SIGTTIN, SIGTTOU, SIGSTOP, or SIGTSTOP signal.

If the wait3 function returns because the status of a child process is available, the process ID of the child process is returned. Information is stored in the location pointed to by status_location, if this pointer is not null.

The value stored in the location pointed to by status_location is 0 (zero) only if the status is returned from a terminated child process that did one of the following:

Regardless of the status_location value, you can define this information using the macros defined in the <wait.h> header file, which evaluate to integral expressions. In the following macro descriptions, the status_value argument is equal to the integer value pointed to by the status_location argument:
WIFEXITED (status_value ) Evaluates to a nonzero value if status was returned for a child process that terminated normally.
WEXITSTATUS (status_value ) If the value of WIFEXITED (status_value ) is nonzero, this macro evaluates to the low-order 8 bits of the status argument that the child process passed to the _exit or exit function, or to the value the child process returned from the main function.
WIFSIGNALED (status_value ) Evaluates to a nonzero value if status was returned for a child process that terminated due to the receipt of a signal that was not caught.
WTERMSIG (status_value ) If the value of WIFSIGNALED (status_value ) is nonzero, this macro evaluates to the number of the signal that caused the termination of the child process.
WIFSTOPPED (status_value ) Evaluates to a nonzero value if status was returned for a child process that is currently stopped.
WSTOPSIG (status_value ) If the value of WIFSTOPPED (status_value ) is nonzero, this macro evaluates to the number of the signal that caused the child process to stop.
WIFCONTINUED (status_value ) Evaluates to a nonzero value if status was returned for a child process that has continued.


Previous Next Contents Index