Co Stephen
2004-01-20 19:05:01 UTC
Hi,
I've made my hangman program so that it only reads 1 character guess
without the user pressing ENTER (\n). (i.e. The program reads the
character input right away into the buffer without detecting a newline
character). This is to prevent any witty chumps from entering a string
and then pressing ENTER to intentionally cause problems. I know that
under DOS/Windows environments, the functions to do this is already
there but under Linux it's a little wierd. I tried setting the using the
system function to set it to "cooked" and afterwards set it to "raw" but
that didn't work so I had to code an entire function to do that.
I assume that the automarker will input a string instead of a character
for that portion of the program as a boundary check. Due to my code's
nature, the string will automatically be read in character by character
(i.e. each character in the string becomes a guess). Would I lose marks
if the automarker fails in that sense? Or do I have to re-code it so
that when the user enters a string instead of a character, the program
would output to the screen a message telling them to re-enter a character?
Thanks,
S Co
I've made my hangman program so that it only reads 1 character guess
without the user pressing ENTER (\n). (i.e. The program reads the
character input right away into the buffer without detecting a newline
character). This is to prevent any witty chumps from entering a string
and then pressing ENTER to intentionally cause problems. I know that
under DOS/Windows environments, the functions to do this is already
there but under Linux it's a little wierd. I tried setting the using the
system function to set it to "cooked" and afterwards set it to "raw" but
that didn't work so I had to code an entire function to do that.
I assume that the automarker will input a string instead of a character
for that portion of the program as a boundary check. Due to my code's
nature, the string will automatically be read in character by character
(i.e. each character in the string becomes a guess). Would I lose marks
if the automarker fails in that sense? Or do I have to re-code it so
that when the user enters a string instead of a character, the program
would output to the screen a message telling them to re-enter a character?
Thanks,
S Co