Add note about fgets() in 1990/cmills
About why it's useful. It's both a problem to keep gets() but it's also
potentially a problem to change it to fgets(). But as it will prevent
alarming the user with warnings about gets() and also causing messed up
output (see below) this is useful.
With the original code one will see under macOS something like:
$ ./cmills.alt
Shuffle...
warning: this program uses gets(), which is unsafe.
Total $1000. Wager?
which is very wrong.
I did not delete the cmills.alt.c but perhaps it should be deleted. That
can come another time.
This commit is contained in:
1 parent
2d7cfef50c
commit
965759365d
1 file changed
+2
-1
@@ -23,7 +23,8 @@ work in modern systems (it resulted in a bus error otherwise). Thank you Yusuke
|
||||
for your assistance!
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) made this safer by
|
||||
using `fgets()` instead of `gets()`. Thank you Cody!
|
||||
using `fgets()` instead of `gets()`. This avoids a potentially alarming warning
|
||||
at linking or runtime. Thank you Cody for your assistance!
|
||||
|
||||
The original bug fixed version is in [cmills.alt.c](cmills.alt.c), described in
|
||||
the `Alternate code` section.
|
||||
|
||||
Reference in new issue
Block a user