Writes a string to a stream.
Standard I/O Library (libc.a)
#include <stdio.h> int puts (String) const char *String; int fputs (String, Stream) const char *String; FILE *Stream;
The puts subroutine writes the string pointed to by the String parameter to the standard output stream, stdout, and appends a new-line character to the output.
The fputs subroutine writes the null-terminated string pointed to by the String 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.
After the fputwc, putwc, fputc, fputs, puts, or putw subroutine runs successfully, and before the next successful completion of a call either 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.
|Points to a string to be written to output.
|Points to the FILE structure of an open file.
Upon successful completion, the puts and fputs subroutines return the number of characters written. Otherwise, both subroutines return EOF, set an error indicator for the stream and set the errno global variable to indicate the error. This happens if the routines try to write to a file that has not been opened for writing.
If the puts or fputs subroutine is unsuccessful because the output stream specified by the Stream parameter is unbuffered or the buffer needs to be flushed, it returns one or more of the following error codes:
|Indicates that the O_NONBLOCK flag is set for the file descriptor specified by the Stream parameter and the process would be delayed in the write operation.
|Indicates that the file descriptor specified by the Stream parameter is not a valid file descriptor open for writing.
|Indicates that an attempt was made to write to a file that exceeds the process' file size limit or the systemwide maximum file size.
| Indicates that the write operation was terminated due to receipt of a signal and no data was
Note: Depending upon which library routine the application binds to, this subroutine may return EINTR. Refer to the signal subroutine regarding the SA_RESTART bit.
|Indicates that the process is a member of a background process group attempting to perform a write to its controlling terminal, the TOSTOP flag is set, the process is neither ignoring or blocking the SIGTTOU signal, and the process group of the process has no parent process.
|Indicates that there was no free space remaining on the device containing the file specified by the Stream parameter.
|Indicates that an attempt is made to write to a pipe or first-in-first-out (FIFO) that is not open for reading by any process. A SIGPIPE signal will also be sent to the process.
|Indicates that insufficient storage space is available.
|Indicates that a request was made of a nonexistent device, or the request was outside the capabilities of the device.
These subroutines are part of Base Operating System (BOS) Runtime.
The fopen, freopen, or fdopen subroutine, fread, or fwrite subroutine, gets or fgets subroutine, getws or fgetws subroutine, printf, fprintf, and sprintf subroutine, putc, putchar, fputc, or putw subroutine, putwc, putwchar, or fputwc subroutine, putws or fputws subroutine.
The feof, ferror, clearerr, or fileno macros.
List of String Manipulation Services.
Subroutines Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.