mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
79 lines
2.4 KiB
Plaintext
79 lines
2.4 KiB
Plaintext
NAME
|
|
fgetfield - read the next word from a file
|
|
|
|
SYNOPSIS
|
|
fgetfield(fs)
|
|
|
|
TYPES
|
|
fs file stream open for reading
|
|
|
|
return string, null or error value
|
|
|
|
DESCRIPTION
|
|
If characters cannot be read from the file, an error value is returned.
|
|
|
|
Otherwise starting at the current file position, any whitespace
|
|
characters are skipped. If the reading reaches end-of-file, the
|
|
null value is returned. If non-whitespace is encountered, formation
|
|
of a string begins, continuing until whitespace of '\0' or end-of-file
|
|
is reached. The returned value is this string (terminated as usual
|
|
by a null character). After the operation, the file position will
|
|
be immediately after the first whitespace character of '\0' or at
|
|
end-of-file.
|
|
|
|
EXAMPLE
|
|
|
|
> f = fopen("/tmp/junk", "w")
|
|
> fputs(f, " Alpha Beta \n")
|
|
> freopen(f, "r")
|
|
> fgetfield(f)
|
|
"Alpha"
|
|
> fgetfield(f)
|
|
"Beta"
|
|
> fgetfield(f)
|
|
>
|
|
> freopen(f, "w")
|
|
> fputstr(f, " Alpha ", "Beta")
|
|
> freopen(f, "r")
|
|
> fgetfield(f)
|
|
"Alpha"
|
|
> fgetfield(f)
|
|
""
|
|
> fgetfield(f)
|
|
"Beta"
|
|
|
|
LIMITS
|
|
none - XXX - is this correct?
|
|
|
|
LINK LIBRARY
|
|
none - XXX - is this correct?
|
|
|
|
SEE ALSO
|
|
fgetstr, fputstr, fgets, fputs, fopen, files, fprintf
|
|
|
|
## Copyright (C) 1999 Landon Curt Noll
|
|
##
|
|
## Calc is open software; you can redistribute it and/or modify it under
|
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
|
## as published by the Free Software Foundation.
|
|
##
|
|
## Calc is distributed in the hope that it will be useful, but WITHOUT
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
|
## Public License for more details.
|
|
##
|
|
## A copy of version 2.1 of the GNU Lesser General Public License is
|
|
## distributed with calc under the filename COPYING-LGPL. You should have
|
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
|
##
|
|
## @(#) $Revision: 29.2 $
|
|
## @(#) $Id: fgetfield,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgetfield,v $
|
|
##
|
|
## Under source code control: 1996/04/30 03:05:17
|
|
## File existed as early as: 1996
|
|
##
|
|
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
|
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|