[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


putws or fputws Subroutine

Purpose

Writes a wide-character string to a stream.

Library

Standard I/O Library (libc.a)

Syntax

#include <stdio.h>


int putws ( String)
const wchar_t *String;


int fputws (String Stream)
const wchar_t *String;
FILE *Stream;

Description

The putws subroutine writes the const wchar_t string pointed to by the String parameter to the standard output stream (stdout) as a multibyte character string and appends a new-line character to the output. In all other respects, the putws subroutine functions like the puts subroutine.

The fputws subroutine writes the const wchar_t string pointed to by the String parameter to the output stream as a multibyte character string. In all other respects, the fputws subroutine functions like the fputs subroutine.

After the putws or fputws subroutine runs successfully, and before the next successful completion of a call to the fflush or fclose subroutine on the same stream or a call to the exit or abort subroutine, the st_ctime and st_mtime fields of the file are marked for update.

Parameters


String Points to a string to be written to output.
Stream Points to the FILE structure of an open file.

Return Values

Upon successful completion, the putws and fputws subroutines return a nonnegative number. Otherwise, a value of -1 is returned, and the errno global variable is set to indicate the error.

Error Codes

The putws or fputws subroutine is unsuccessful if the stream is not buffered or data in the buffer needs to be written, and one of the following errors occur:

EAGAIN The O_NONBLOCK flag is set for the file descriptor underlying the Stream parameter, which delays the process during the write operation.
EBADF The file descriptor underlying the Stream parameter is not valid and cannot be updated during the write operation.
EFBIG The process attempted to write to a file that already equals or exceeds the file-size limit for the process.
EINTR The process has received a signal that terminates the read operation.
EIO The process is in a background process group attempting to perform a write operation to its controlling terminal. The TOSTOP flag is set, the process is not ignoring or blocking the SIGTTOU flag, and the process group of the process is orphaned.
ENOSPC No free space remains on the device containing the file.
EPIPE The process has attempted to write to a pipe or first-in-first-out (FIFO) that is not open for reading. The process also receives a SIGPIPE signal.
EILSEQ The wc wide-character code does not correspond to a valid character.

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

Related Information

Other wide-character I/O subroutines: fgetwc (getwc, fgetwc, or getwchar Subroutine) subroutine, fgetws (getws or fgetws Subroutine) subroutine, fputwc (putwc, putwchar, or fputwc Subroutine) subroutine, getwc (getwc, fgetwc, or getwchar Subroutine) subroutine, getwchar (getwc, fgetwc, or getwchar Subroutine) subroutine, getws (getws or fgetws Subroutine) subroutine, putwc (putwc, putwchar, or fputwc Subroutine) subroutine, putwchar (putwc, putwchar, or fputwc Subroutine) subroutine, ungetwc subroutine.

Related standard I/O subroutines: fdopen (fopen, fopen64, freopen, freopen64 or fdopen Subroutine) subroutine, fgets (gets or fgets Subroutine) subroutine, fopen (fopen, fopen64, freopen, freopen64 or fdopen Subroutine) subroutine, fprintf (printf, fprintf, sprintf, wsprintf, vprintf, vfprintf, vsprintf, or vwsprintf Subroutine) subroutine, fputc (putc, putchar, fputc, or putw Subroutine) subroutine, fputs (puts or fputs Subroutine) subroutine, fread (fread or fwrite Subroutine) subroutine, freopen (fopen, fopen64, freopen, freopen64 or fdopen Subroutine) subroutine, fwrite (fread or fwrite Subroutine) subroutine, gets (gets or fgets Subroutine) subroutine, printf (printf, fprintf, sprintf, wsprintf, vprintf, vfprintf, vsprintf, or vwsprintf Subroutine) subroutine, putc (putc, putchar, fputc, or putw Subroutine) subroutine, putchar (putc, putchar, fputc, or putw Subroutine) subroutine, puts (puts or fputs Subroutine) subroutine, putw (putc, putchar, fputc, or putw Subroutine) subroutine, sprintf (printf, fprintf, sprintf, wsprintf, vprintf, vfprintf, vsprintf, or vwsprintf Subroutine) subroutine.

National Language Support Overview for Programming, Subroutines Overview, Understanding Wide Character Input/Output Subroutines in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]