42_EXAM icon indicating copy to clipboard operation
42_EXAM copied to clipboard

Cheat commands always (falsely) ON & Undefined behavior if CTRL+D is pressed

Open Kuninoto opened this issue 2 years ago • 0 comments

Hello there!, While trying to force grademe to give me do_op ex (in the ambience of trying to fix issue #61) I've noticed that entering the settings command the cheat commands are always ON and I cannot use any of them (force_success for example).

Also I've noticed that because you're using readline if in the settings menu I send the EOT signal i.e CTRL+D it enters an infinite loop where I can't write anymore. To solve that, in every read and evaluate loop you should check for EOF on the cin stream and if you find it it's because a CTRL+D was pressed. Bellow I'll leave a MRE of the checks that should be on the read and evaluate loop.

if (cin.eof() == true) { cin.clear(); clearerr(stdin); }

Kuninoto avatar Feb 21 '23 02:02 Kuninoto