FGETS(3S) FGETS(3S) NAME fgets, puts, fputs, gets - string input/out on streams SYNOPSIS #include <stdio.h> char *fgets(s, n, stream) char *s; FILE *stream; int puts(s) char *s; int fputs(s, stream) char *s; FILE *stream; DESCRIPTION Fgets reads n-1 characters, or up to a newline character, whichever comes first, from the stream into the string s. The last character read into s is followed by a null charac- ter. Fgets returns its first argument. Puts copies the null-terminated string s to the standard output stream stdout and appends a newline character. Fputs copies the null-terminated string s to the named out- put stream. Neither routine copies the terminal null character. Both return the result of calling putc with the last character written; see getc(3). SEE ALSO getc(3) stdio(3) DIAGNOSTICS Fgets returns a null pointer upon end of file or error. Puts and fputs return the constant on write error. BUGS For safety reasons the ANSI standard function char *gets(s), which reads from standard input up to a newline and discards the newline, is not supported. Puts appends a newline, fputs does not, all in the name of backward compatibility.