I'm trying to code a basic video-game and would like the input to be entered from the keyboard. Therefore, I need to read the characters on the standard input as they are produced. Because of the buffering, io:get_chars, io:fread will return only after the return key is pressed.
- Is it possible to access the characters in the standard input as they are produced?
- How should I do it?
The point of the project is not to make a real-life game, it is just a way of learning about Erlang. Therefore performance is not an issue.
EDIT: This project seems to offer the feature I am looking for. If I am not mistaken, though, a part of the code is written in C and sends the characters to the Erlang part via message passing. Is there an alternative, native to Erlang, to this approach, or is this the only approach that would work?