gets -- read a line from a file
This command reads the next line from the file given by
and discards the terminating newline character. If
is specified then the line is placed in the variable by that name and the return value is a count of the number of characters read (not including the newline). If the end of the file is reached before reading any characters then -1 is returned and
is set to an empty string. If
is not specified then the return value will be the line (minus the newline character) or an empty string if the end of the file is reached before reading any characters. An empty string will also be returned if a line contains no characters except the newline, so
may have to be used to determine what really happened. If the last character in the file is not a newline character then
behaves as if there were an additional newline character at the end of the file.
or the return value from a previous call to
; it must refer to a file that was opened for reading. Any existing end-of-file or error condition on the file is cleared at the beginning of the
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003