Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fopen(3S)

fread(3S)

gets(3S)

getws(3S)

printf(3S)

putc(3S)

putwc(3S)

putws(3S)

PUTS(3)                              SysV                              PUTS(3)



NAME
     puts, fputs - write a string to a stream

SYNOPSIS
     #include <stdio.h>

     int puts (string)
     char *string;

     int fputs (string, stream)
     char *string;
     FILE *stream;

DESCRIPTION
     The puts function writes the null-terminated string pointed to by the
     string argument, followed by a newline character, to the standard output
     stream, stdout.

     The fputs function writes the null-terminated string pointed to by the
     string argument to the output stream specified by the stream argument.
     The fputs function does not append a newline character.

     string points to a string to be written to output; stream points to the
     FILE structure of an open file.

     Neither function writes the terminating null character.  The st_ctime and
     st_mtime fields of the file are marked for update between the successful
     execution of the puts or fputs function, and the next successful
     completion of a call to the fflush or fclose function on the same stream,
     or a call to the exit or abort function.

DIAGNOSTICS
     Upon successful completion, the puts and fputs functions 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.

ERRORS
     The puts and fputs functions fail if either the stream is unbuffered, or
     the stream's buffer needed to be flushed and the function call caused an
     underlying the write or lseek function to be invoked. In addition, the
     puts and fputs functions fail if

     [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' file size limit or the maximum file size.

     [EINTR]        The read operation was interrupted by a signal which was
                    caught, and no data was transferred.

     [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.
     [ENOSPC]       There was no free space remaining on the device containing
                    the file.

     [EPIPE]        An attempt was made to write to a pipe or FIFO that is not
                    open for reading by any process.  A SIGPIPE signal will
                    also be sent to the process.

SEE ALSO
     fopen(3S), fread(3S) gets(3S), getws(3S), printf(3S), putc(3S),
     putwc(3S), putws(3S)

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