Galleondragon/qb64

Problems with `INKEY$` and `$CONSOLE`

Closed this issue · 6 comments

Kroc commented

I'm trying to get input from a console, without a screen visible -- i.e. $CONSOLE:ONLY or $CONSOLE + $SCREENHIDE -- but this doesn't work. INKEY$ documentation states that if _DEST _CONSOLE is used, input will be taken from the console.

Sample code:

$CONSOLE
$SCREENHIDE
_DEST _CONSOLE

DO
    DIM k$
    LET k$ = INKEY$
LOOP WHILE k$ = ""

Looks like the documentation is wrong on this one. Try adding _SOURCE _CONSOLE to your program (I didn't test it yet, I'm on my phone) and let me know if it works.

Just tested. It indeed does not work.

I still assume the documentation is wrong on this one. INPUT does work from the console (in which case _DEST _CONSOLE is required), but INKEY$ was probably never intended.

Kroc commented

Was this fixed, or should I use an alternative method?

INKEY$ is not supported in console windows, you should find an alternative for now. INPUT does work.

Kroc commented

OK, thanks! 👍

Kroc commented

Addendum: INPUT requires pressing Enter, which isn't really what I want. INPUT$ also does not work as like INKEY$