Make 1990/cmills use fgets() instead of gets()
In the README.md I explained the difference in case someone wishes to change the fgets() version back to gets(). I decided to not make it an alt version as it was discussed that usually there should not be an alt version.
This commit is contained in:
1 parent
23d1053c48
commit
bede24af38
2 files changed
+20
-10
No files matched your search
+18
-8
@@ -18,27 +18,37 @@ We used a patch from [Yusuke Endoh](/winners.html#Yusuke_Endoh) to get this to
|
||||
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 the program safer
|
||||
by using `fgets()` instead of `gets()`. Thank you Cody for your help in making
|
||||
this safer! For the original code you can change the instances of:
|
||||
|
||||
|
||||
!fgets(l,M,stdin)
|
||||
|
||||
to:
|
||||
|
||||
!gets(l)
|
||||
|
||||
|
||||
### Try:
|
||||
|
||||
./cmills 5000
|
||||
|
||||
|
||||
NOTE: this program uses `gets()` so you will likely get a warning under modern
|
||||
systems.
|
||||
## Judges' comments:
|
||||
|
||||
## Judges' comments
|
||||
|
||||
Compile notes:
|
||||
|
||||
cc -DM=500 -DN=52 -DX="srand((int)time(0L))" -DV=void -o cmills cmills.c
|
||||
The Makefile uses several `-D` defines. The following is is a list of the macros
|
||||
that may be changed:
|
||||
|
||||
-DM=<max bet allowed>
|
||||
-DN=<52 * number of decks used>
|
||||
-DX=<how to seed the rand() generator>
|
||||
-DV=<void ot int>
|
||||
|
||||
## Author's comments
|
||||
The macro `V` should remain `void`.
|
||||
|
||||
|
||||
## Author's comments:
|
||||
|
||||
This is a blackjack program. It does splits, doubling down,
|
||||
insurance, etc.
|
||||
|
||||
Reference in new issue
Block a user