puts(3C)
_________________________________________________________________
puts function
Write to the standard output file until encountering a null byte.
_________________________________________________________________
Calling Sequence
char *stringbuf, puts();
puts(stringbuf);
where stringbuf is a pointer to a user-provided character
array.
Description
Use the puts function to write to the standard output file.
Unlike fputs, the puts function appends a New Line to the output
characters.
The include file stdio.h defines the puts function.
See the "Input/Output Functions and Macros" section of Chapter 1
for buffering information on the puts function.
Returns
The puts function returns -1 if an error occurs; otherwise, it
returns 0.
Related Functions
See also the gets and fputs functions.
Example
/* Program test for the puts() function on strings */
#include <stdio.h>
char store[132], *strcpy();
int i = 1;
main(argc, argv)
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
puts(3C)
int argc;
char *argv[];
{
while(i < argc)
{
strcpy(store, argv[i]);
puts(store);
i++;
}
}
A call to the program test with the sentence
This is a complete listing of your strings.
generates the output
This
is
a
complete
listing
of
your
strings.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)