DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

puts(S)


puts, fputs -- put a string on a stream

Syntax

cc . . . -lc

#include <stdio.h>

int puts (const char *s);

int fputs (const char *s, FILE *stream);

Description

puts- writes null-terminated string to standard output stream

fputs- writes nul-terminated string to named output stream

The puts function writes the null-terminated string pointed to by s, followed by a new-line character, to the standard output stream stdout.

fputs writes the null-terminated string pointed to by s to the named output stream.

Neither function writes the terminating null character.

Diagnostics

Both routines return EOF on error, which occurs if the routines try to write to a file that has not been opened for writing.

Notes

The puts function appends a new-line character while fputs does not.

See also

ferror(S), fopen(S), fread(S), printf(S), putc(S), stdio(S)

Standards conformance

fputs and puts are conformant with:

X/Open Portability Guide, Issue 3, 1989 ;
ANSI X3.159-1989 Programming Language -- C ;
Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2) ;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
and NIST FIPS 151-1 .


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003