Shop OBEX P1 Docs P2 Docs Learn Events
Non blocking INPUT? — Parallax Forums

Non blocking INPUT?

Been a while since I used FlexBasic but I thought we had a way of checking for a character waiting in the keyboard buffer before grabbing it?

I use lots of Basics so maybe I'm confused.




  • ersmithersmith Posts: 5,987

    @Mickster : We don't have a non-blocking INPUT, or really anything like it at the high level (i.e. which can work with arbitrary files).

    For just the keyboard, there is a low level (undocumented) function to read with a timeout:

      ch = _rxraw(ms_timeout)

    If you give a timeout of zero (so _rxraw(0)) then it will return immediately with -1 if there is no key available, otherwise it returns the key.

  • MicksterMickster Posts: 2,629
    edited 2024-04-04 13:46

    Hi Eric,

    In my case, a _rxraw(0) blocks but _rxraw(-1) works beautifully. Many thanks :+1:


Sign In or Register to comment.