Make 1994/ldb use fgets()
I had already fixed this entry to compile with modern compilers but a problem existed where lines longer than 231 characters (which generally would not happen but is not impossible) would overflow the buffer. Now it uses fgets() so this does not happen. A couple notes about this though. It right now does print a newline after the output unless the line length is in fact 231 characters. This seems like a worthy compromise though. In time I hope to address this so that it does not ever print a newline (a blank line notwithstanding which does happen and is part of the entry). The second thing to be aware of is just a subtlety with the entry: what happens with a line of length 394? What you'll find is that it might print the first 231 characters or it might print the last 163 characters plus the newline (the 231 one does not have a newline). I've added to bugs.md the part where it will print a newline if the line length < 231. At the same time I fixed a path in the bugs.md file that I noticed.
This commit is contained in:
1 parent
bf845a978d
commit
bf6cd19109
3 files changed
+32
-17
No files matched your search
+1
-1
@@ -1 +1 @@
|
||||
int _,O,__??('}'??);main(){while(O?gets((rand()%O++?':':_)+__)||puts(&__??(_??))&_:(srand(time((O+++_))),0)||O);}
|
||||
int _,O,__??('}'??);main(){while(O?(fgets((rand()%O++?':':_)+__,232,stdin))||puts(&__??(_??))&_:(srand(time((O+++_))),0)||O);}
|
||||
Reference in new issue
Block a user