Prevent console line advancing on user input
anonymouse
anony at mouse.com
Thu Apr 6 08:01:08 UTC 2023
Wondering if this is possible? Ask a user at input and wait for
response:
write("Is the sky blue? ");
readf!" %s\n"(response);
If the user's response is correct, I'd like to change the color
of provided response to indicate it was correct then advance to
the next line and ask a different question.
If the user's response is incorrect, I'd like to clear the line
and repeat the question without advancing down the screen
vertically.
I'm assuming it can be done by intercepting all input before the
console processes them and outputting a '\r', a blank line the
length of the screen, and another '\r' to get back to the
beginning before reprinting the question. But I have no idea how
to intercept the raw input.
Would appreciate any pointers.
Thanks
--anonymouse
More information about the Digitalmars-d-learn
mailing list