![]() Chapter Contents |
![]() Previous |
![]() Next |
| fputs |
| Portability: | ISO/ANSI C conforming, UNIX compatible |
| SYNOPSIS | |
| DESCRIPTION | |
| RETURN VALUE | |
| EXAMPLE | |
| RELATED FUNCTIONS | |
| SEE ALSO |
| SYNOPSIS |
#include <stdio.h> int fputs(const char *str, FILE *f);
| DESCRIPTION |
fputs
writes the characters in the string addressed by
str
to the stream associated with the
FILE
object addressed by
f
. Unlike
puts
,
fputs
does not write a new-line character after the string.
| RETURN VALUE |
fputs
returns an unspecified value unless an error occurs, in which case it returns
EOF
.
| EXAMPLE |
#include <stdio.h>
#define LENGTH 80
char data[ LENGTH + 2] ;
FILE *ff, *nf;
main()
{
/* Open FILE1 to read. */
ff = fopen("tso:FILE1", "r");
/* Open NEXTFILE to write. */
nf = fopen("tso:NEXTFILE", "w");
/* Read a maximum of 81 characters into the data buffer. */
while (fgets(data, LENGTH + 2, ff))
fputs(data, nf); /* Write data into NEXTFILE. */
}
| RELATED FUNCTIONS |
| SEE ALSO |
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.