File:  [CSRG BSD Unix] / 43BSDTahoe / man / man3 / gets.3
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

.\"	@(#)gets.3s	6.1 (Berkeley) 5/15/85
.\"
.TH GETS 3S  "May 15, 1985"
.AT 3
.SH NAME
gets, fgets \- get a string from a stream
.SH SYNOPSIS
.B #include <stdio.h>
.PP
.B char *gets(s)
.br
.B char *s;
.PP
.B char *fgets(s, n, stream)
.br
.B char *s;
.br
.SM
.B FILE
.B *stream;
.SH DESCRIPTION
.I Gets
reads a string into
.I s
from the standard input stream
.BR stdin .
The string is terminated by a newline
character, which is replaced in
.I s
by a null character.
.I Gets
returns its argument.
.PP
.I Fgets
reads 
.IR n \-1
characters, or up through a newline
character, whichever comes first,
from the
.I stream
into the string
.IR s .
The last character read into
.I s
is followed by a null character.
.I Fgets
returns its first argument.
.SH "SEE ALSO"
puts(3S),
getc(3S),
scanf(3S),
fread(3S),
ferror(3S)
.SH DIAGNOSTICS
.I Gets
and
.I fgets
return the constant pointer 
.SM
.B NULL
upon end of file or error.
.SH BUGS
.I Gets
deletes a newline,
.I fgets
keeps it,
all in the name of backward compatibility.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.