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


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


putws(), fputws() — put a wide character string on a stream file


#include <wchar.h>

int putws(const wchar_t *ws);

int fputws(const wchar_t *__restrict ws, FILE *__restrict stream);

Obsolescent Interfaces

int putws_unlocked(const wchar_t *ws);

int fputws_unlocked(const wchar_t *ws, FILE *stream);


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


putws() writes a character string corresponding to the null-terminated wide-character string pointed to by ws followed by a new-line character, to the standard output stream stdout.

fputws() writes a character string corresponding to the null-terminated wide-character string pointed to by ws to the named output stream, but does not append a new-line character or a terminating null character.

Neither function writes a terminating null character.

The definition for these functions, the type wchar_t and the value WEOF are provided in the <wchar.h> header.

Obsolescent Interfaces

putws_unlocked() and fputws_unlocked() put a wide character string on a stream file.


After putws() or fputws() is applied to a stream, the stream becomes wide-oriented (see orientation(5)).



The LC_CTYPE category determines how wide character conversions are done.

International Code Set Support

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


Upon successful completion, putws(), putws_unlocked(), fputws(), and fputws_unlocked() return a non-negative number. Otherwise they return WEOF, set the error indicator for the stream, and set errno to indicate the error.


putws(), putws_unlocked(), fputws(), and fputws_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:


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


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


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


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


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.


There was no free space remaining on the device containing the file.


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.


A wide character in ws does not correspond to a valid character.

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


putws_unlocked() and fputws_unlocked() are obsolescent interfaces supported only for compatibility with existing DCE applications. New multithreaded applications should use putws() and fputws().


putws() and fputws() were developed by OSF and HP.


fputws(): XPG4

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