1999-12-09 17:26:08 +01:00
|
|
|
|
.\" Copyright (c) 1990, 1991, 1993
|
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
|
.\"
|
|
|
|
|
.\" This code is derived from software contributed to Berkeley by
|
|
|
|
|
.\" Chris Torek and the American National Standards Committee X3,
|
|
|
|
|
.\" on Information Processing Systems.
|
|
|
|
|
.\"
|
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
|
.\" are met:
|
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
|
.\"
|
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
|
.\"
|
|
|
|
|
.\" @(#)fgets.3 8.1 (Berkeley) 6/4/93
|
|
|
|
|
.\"
|
2001-05-14 03:10:24 +02:00
|
|
|
|
.\" $FreeBSD$
|
1999-12-09 17:26:08 +01:00
|
|
|
|
.\"
|
|
|
|
|
.Dd June 4, 1993
|
|
|
|
|
.Dt FGETS 3
|
|
|
|
|
.Os
|
|
|
|
|
.Sh ̾<EFBFBD><EFBFBD>
|
|
|
|
|
.Nm fgets ,
|
|
|
|
|
.Nm gets
|
|
|
|
|
.Nd <EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD>फ<EFBFBD><EFBFBD><EFBFBD>饤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
.Sh <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
.Fd #include <stdio.h>
|
|
|
|
|
.Ft char *
|
|
|
|
|
.Fn fgets "char *str" "int size" "FILE *stream"
|
|
|
|
|
.Ft char *
|
|
|
|
|
.Fn gets "char *str"
|
|
|
|
|
.Sh <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
.Fn fgets
|
|
|
|
|
<EFBFBD>ؿ<EFBFBD><EFBFBD>ϡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
.Fa size
|
|
|
|
|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