74 lines
2.0 KiB
HTML
74 lines
2.0 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>gets(3)</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>gets(3)</H1>
|
|
<HR>
|
|
<PRE>
|
|
|
|
</PRE>
|
|
<H2>NAME</H2><PRE>
|
|
gets, fgets - get a string from a stream
|
|
|
|
|
|
</PRE>
|
|
<H2>SYNOPSIS</H2><PRE>
|
|
<STRONG>#include</STRONG> <STRONG><stdio.h></STRONG>
|
|
|
|
<STRONG>char</STRONG> <STRONG>*gets(char</STRONG> <STRONG>*</STRONG><EM>s</EM><STRONG>)</STRONG>
|
|
<STRONG>char</STRONG> <STRONG>*fgets(char</STRONG> <STRONG>*</STRONG><EM>s</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>n</EM><STRONG>,</STRONG> <STRONG>FILE</STRONG> <STRONG>*</STRONG><EM>stream</EM><STRONG>)</STRONG>
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
<STRONG>Gets</STRONG> reads a string into <EM>s</EM> from the standard input stream <STRONG>stdin</STRONG>. The
|
|
string is terminated by a newline character, which is replaced in <EM>s</EM> by a
|
|
null character. <STRONG>Gets</STRONG> returns its argument.
|
|
|
|
<STRONG>Fgets</STRONG> reads <EM>n</EM>-1 characters, or up through a newline character, whichever
|
|
comes first, from the <EM>stream</EM> into the string <EM>s</EM>. The last character read
|
|
into <EM>s</EM> is followed by a null character. <STRONG>Fgets</STRONG> returns its first
|
|
argument.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<STRONG><A HREF="../man3/puts.3.html">puts(3)</A></STRONG>, <STRONG><A HREF="../man3/getc.3.html">getc(3)</A></STRONG>, <STRONG><A HREF="../man3/scanf.3.html">scanf(3)</A></STRONG>, <STRONG><A HREF="../man3/fread.3.html">fread(3)</A></STRONG>, <STRONG><A HREF="../man3/ferror.3.html">ferror(3)</A></STRONG>.
|
|
|
|
|
|
</PRE>
|
|
<H2>DIAGNOSTICS</H2><PRE>
|
|
<STRONG>Gets</STRONG> and <STRONG>fgets</STRONG> return the constant pointer <STRONG>NULL</STRONG> upon end of file or
|
|
error.
|
|
|
|
|
|
</PRE>
|
|
<H2>BUGS</H2><PRE>
|
|
<STRONG>Gets</STRONG> deletes a newline, <STRONG>fgets</STRONG> keeps it, all in the name of backward
|
|
compatibility.
|
|
|
|
<STRONG>Gets</STRONG> is not present in the Minix-vmd C library for reasons that should be
|
|
obvious. Use <STRONG>fgets</STRONG> instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRE>
|
|
</BODY>
|
|
</HTML>
|