Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > P

putwc(3C)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

putwc(), putwchar(), fputwc() — put a wide character on a stream file

SYNOPSIS

#include <wchar.h>

wint_t putwc(wint_t wc, FILE *stream);

wint_t putwchar(wint_t wc);

wint_t fputwc(wint_t wc, FILE *stream);

_INCLUDE__STDC_A1_SOURCE only

wint_t putwc(wchar_t wc, FILE *stream);

wint_t putwchar(wchar_t wc);

wint_t fputwc(wchar_t wc, FILE *stream);

Obsolescent Interfaces

wint_t putwc_unlocked(wint_t wc, FILE *stream);

wint_t putwchar_unlocked(wint_t wc);

wint_t fputwc_unlocked(wint_t wc, FILE *stream);

Remarks:

These functions are compliant with the XPG4 Worldwide Portability Interface wide-character I/O functions. They parallel the 8-bit character I/O functions defined in putc(3S).

DESCRIPTION

putwc()

Writes the character corresponding to the wide character wc onto the output stream at the position where the file pointer is pointing. putwchar(wc) is defined as putwc(wc, stdout). putwc() and putwchar() are defined both as macros and as functions.

fputwc()

Behaves like putwc(), but is a function rather than a macro, and can therefore be used as an argument.

Output streams, with the exception of the standard error stream stderr, are by default buffered if the output refers to a file and line-buffered if the output refers to a terminal. The standard error output stream, stderr, is by default unbuffered, but use of freopen() (see fopen(3S)) causes it to become buffered or line-buffered. setbuf() or setvbuf() (see setbuf(3S)) can be used to change the stream's buffering strategy.

Definitions for these functions, the type wint_t and the value WEOF are provided in the <wchar.h> header.

Obsolescent Interfaces

putwc_unlocked(), putwchar_unlocked(), and fputwc_unlocked() put a wide character on a stream file.

APPLICATION USAGE

To use the _INCLUDE__STDC_A1_SOURCE prototype, the _INCLUDE__STDC_A1_SOURCE flag must be passed as a compiler option or defined as a macro in source files.

After fputwc(), putwc(), or putwchar() is applied to a stream, the stream becomes byte-oriented (see orientation(5)).

EXTERNAL INFLUENCES

Locale

The LC_CTYPE category determines how wide character conversions are done.

International Code Set Support

Single- and multi-byte character code sets are supported.

RETURN VALUE

On success, putwc(), putwc_unlocked(), fputwc(), fputwc_unlocked(), putwchar(), and putwchar_unlocked() each return the wide character corresponding to the value they have written. On failure, they return the constant WEOF, set the error indicator for the stream, and set errno to indicate the error.

ERRORS

putwc(), putwc_unlocked(), putwchar(), putwchar_unlocked(), fputwc(), and fputwc_unlocked() fail if either the stream is unbuffered, or stream's buffer needed to be flushed causing an underlying write() call to be invoked, and:

[EAGAIN]

The O_NONBLOCK flag is set for the file descriptor underlying stream and the process would be delayed in the write operation.

[EBADF]

The file descriptor underlying stream is not a valid file descriptor open for writing.

[EFBIG]

An attempt was made to write to a file that exceeds the process's file size limit or the maximum file size (see ulimit(2)).

[EINTR]

A signal was caught during the write() system call.

[EIO]

A physical I/O error has occurred, or the process is in a background process group and is attempting to write to its controlling terminal, TOSTOP is set, the process is neither ignoring nor blocking the SIGTTOU signal, and the process group of the process is orphaned.

[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. A SIGPIPE signal is also sent to the process.

[EILSEQ]

The wide character wc does not correspond to a valid character.

Additional errno values can be set by the underlying write() function (see write(2)).

WARNINGS

Line buffering may cause confusion or malfunctioning of programs that use wide character I/O routines but use read() themselves to read from standard input. When a large amount of computation is done after printing part of a line on an output terminal, it is necessary to fflush() (see fclose(3S)) the standard output before beginning the computation.

putwc_unlocked(), putwchar_unlocked() and fputwc_unlocked() are obsolescent interfaces supported only for compatibility with existing DCE applications. New multithreaded applications should use putwc(), putwchar() and fputwc().

AUTHOR

putwc() was developed by OSF and HP.

STANDARDS CONFORMANCE

putwc(): XPG4

fputwc(): XPG4

putwchar(): XPG4

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.