[5440] in Athena Bugs
rt 7.0F: gets(3s)
daemon@ATHENA.MIT.EDU (cfields@ATHENA.MIT.EDU)
Fri Jul 6 18:29:53 1990
From: cfields@ATHENA.MIT.EDU
To: bugs@ATHENA.MIT.EDU
Date: Fri, 06 Jul 90 18:29:35 EDT
System name: entropy
Type and version: RTPC-ROMPC 7.0F (1 update(s) to same version)
Display type: apa16
What were you trying to do?
Use fgets().
What's wrong:
Fgets reads n-1 characters, or up through a newline charac-
ter, whichever comes first, from the stream into the string
s. The last character read into s is followed by a null
character. Fgets returns its first argument.
The manual page doesn't explain what happens if the function reaches
end of file before a newline.
What should have happened:
The proper behavior for this case is clear, but it should be
documented anyway. I don't like having to look at the source to make
sure.
Fgets reads n-1 characters, up through a newline charac-
ter, or to end of file, whichever comes first, from the stream
into the string s. The last character read into s is followed
by a null character. Fgets returns its first argument.
This is not necessarily the best way to word it.
Please describe any relevant documentation references:
gets(3s), fgets.c