Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ puts(3s) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

feof, ferror, clearerr, fileno

fopen, freopen, fdopen

fread, fwrite

gets, fgets, getws, fgetws

printf, fprintf, sprintf, NLprintf, NLfprintf, NLsprintf, wsprintf

putc, putchar, fputc, putw, putwc, putwchar, fputwc

stdio



PUTS(3s,L)                  AIX Technical Reference                  PUTS(3s,L)



-------------------------------------------------------------------------------
puts, fputs, putws, fputws



PURPOSE

Writes a string to a stream.

LIBRARY

Standard I/O Library (libc.a)

SYNTAX

#include <stdio.h>




                int puts (s)                int fputs (s, stream)
                char *s;                    char *s;
                                            *stream;
                int putws (s)
                const wchar_t *s;

                int fputws (s, stream);

                const wchar_t *s;
                FILE *stream;



DESCRIPTION

The puts subroutine writes the NULL-terminated string pointed to by the s
parameter, followed by a new-line character, to the standard output stream,
stdout.

The fputs subroutine writes the NULL-terminated string pointed to by the s
parameter to the output stream specified by the stream parameter.  The fputs
subroutine does not append a new-line character.

Neither subroutine writes the terminating NULL character.

The putws subroutine writes the character string pointed to by s to the stream
pointed to by stdout as a multibyte character string and appends a new-line
character to the output.  The terminating NULL character is not written.

The fputws subroutine writes the string pointed to by s to the stream pointed
to by stream as a multibyte character string. The terminating NULL character is
not written.



Processed November 7, 1990        PUTS(3s,L)                                  1





PUTS(3s,L)                  AIX Technical Reference                  PUTS(3s,L)




RETURN VALUE

Upon successful completion, the puts and fputs subroutines return the number of
characters written.  Both subroutines return EOF on an error.  This happens if
the routines try to write on a file that has not been opened for writing.

The putws and fputws subroutines return -1 if a write error occurs; otherwise,
they return a non-negative value.

ERROR CONDITIONS

The puts and fputs subroutines fail if one or more of the following conditions
are true:

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

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

          Note:  If a wide character routine fails and errno is not set, this
                 indicates that the translation from wide code to file code has
                 failed.

EFBIG     An attempt was made to write to a file that exceeds the process's
          file size limit or the maximum file size.

EINTR     The write operation was terminated due to the receipt of a signal,
          and either no data was transferred or the implementation does not
          report partial transfers for this file.

EIO       The implementation supports job control, the process is a member of a
          background process group attempting to write to its controlling
          terminal, TOSTOP is set, the process is neither ignoring nor blocking
          SIGTTOU and the process group of the process is orphaned.  This error
          may also be returned under implementation-defined conditions.

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

ENXIO     A request was made of a non-existent device, or the request was
          outside the capabilities of the device.

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.

ENOMEM    Insufficient storage space is available.

RELATED INFORMATION





Processed November 7, 1990        PUTS(3s,L)                                  2





PUTS(3s,L)                  AIX Technical Reference                  PUTS(3s,L)



In this book:  "feof, ferror, clearerr, fileno," "fopen, freopen, fdopen,"
"fread, fwrite," "gets, fgets, getws, fgetws," "printf, fprintf, sprintf,
NLprintf, NLfprintf, NLsprintf, wsprintf," "putc, putchar, fputc, putw, putwc,
putwchar, fputwc," and "stdio."

AIX Guide to Multibyte Character Set (MBCS) Support.

















































Processed November 7, 1990        PUTS(3s,L)                                  3



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026