Why is my fucking code waiting to a EOL to get stuff if I'm calling a read which is supposed to get just one char?


Should I flush anything?

What's going on here?

I need to put my terminal in character mode and what the fuck.

How is it this difficult in Java/Clojure.

I think in C it comes by default...?

@ekaitz_zarraga I don't think so? In C and C++ when I read from the terminal it's always line buffered. You have to do some hoop jumping to make it unbuffered.

This is a feature of the Unix terminal interface and has nothing to with the language used. Even when you call the read() system call directly you have the same behaviour.

You need to set the terminal to raw mode in order to be able to read character by character.

@loke @CharredStencil Exactly. My research took me there.
There's a POSIX interface for this. You have to choose the non-canonical mode.

I thought C was like that but nope. I'm getting old very fast.

Sign in to participate in the conversation

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!