fputs(3C)
_________________________________________________________________
fputs function
Write a string to a specified file.
_________________________________________________________________
Calling Sequence
#include <stdio.h>
FILE *fp;
char *stringbuf;
int fputs();
fputs(stringbuf, fp);
where stringbuf is a pointer to a user-provided buffer.
fp is a pointer to a FILE stream.
Description
The fputs function writes a string to a file you specify. The
function writes until it encounters a null byte. It does not
append a New Line.
The include file dg_stdio.h defines fputs.
Returns
The function returns -1 on error, 0 otherwise.
Related Functions
See also the dg_fgets, fgets, fprintf, printf, and puts
functions.
Example
/* Program test for the fputs() function */
#include <stdio.h>
FILE *fp;
int i = 2, fputs();
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
fputs(3C)
main(argc, argv)
int argc;
char *argv[];
{
fp = fopen(argv[1], "a");
while (i < argc) {
fputs(argv[i], fp);
i++;
}
}
A call to the program test with the file input_str and the
arguments mul ti syl lab bic appends to the file the string
multisyllabic
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)