This command reads the next line from the file given by fileIdand discards the terminating newline character.If varName is specified then the line is placed in the variableby that name and the return value is a count of the number of charactersread (not including the newline).If the end of the file is reached before readingany characters then -1 is returned and varName is set to anempty string.If varName is not specified then the return value will bethe line (minus the newline character) or an empty string ifthe end of the file is reached before reading any characters.An empty string will also be returned if a line contains no charactersexcept the newline, so eof may have to be used to determinewhat really happened.If the last character in the file is not a newline character then gets behaves as if there were an additional newline characterat the end of the file.fileId must be stdin or the return value from a previouscall to open; it must refer to a file that was openedfor reading.
Any existing end-of-file or error condition on the file is cleared atthe beginning of the gets command.