In C or C++ you can use this:
#include <termios.h>
#include <unistd.h>
struct termios setUnbufferedInput() {
struct termios oldt, newt;
tcgetattr(STDIN_FILENO, &oldt);
newt = oldt;
newt.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
return oldt;
}
void resetInput(struct termios oldt) {
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
}
In Java you can use a library - but with OnlineGDB there is no way to add a library.
And OnlineGDB only lets you compile C code OR Java code but not both at once - so there is no way to use JNI.
So, I don't think there is any way to do this with OnlineGDB.