Add note about fgets() in 1990/tbr
About why it's useful. It's a problem to keep gets() but it might be a
problem to not keep it as well. Nevertheless with macOS the output of
the alternative code (which probably should be deleted but this can
happen another time) is confusing:
$ ./tbr.alt
$ warning: this program uses gets(), which is unsafe.
[]
The [] is the cursor on a blank line. The first line of output of the
program (which is not supposed to have a newline) instead has the
warning and then a newline appended to it.
This commit is contained in:
1 parent
965759365d
commit
58f30bd65e
1 file changed
+3
-2
+3
-2
@@ -23,8 +23,9 @@ make all
|
||||
modern compilers; `exit(3)` returns void but the function was used in a binary
|
||||
expression so this wouldn't even compile. Cody also changed the code to use
|
||||
`fgets()` instead of `gets()` so one would not get a warning about the use of
|
||||
`gets()` at execution which was interspersed with the output. Thank you Cody for
|
||||
your assistance!
|
||||
`gets()` at linking time or execution, the latter case causing confusing output
|
||||
due to the warning being interspersed with the program's output. Thank you Cody
|
||||
for your assistance!
|
||||
|
||||
For the original version with `gets()` see the alternate code section below.
|
||||
|
||||
|
||||
Reference in new issue
Block a user