nothing about target OS, nothing about real purpose, IMHO my answer was legit.
target os is linux, the purpose is writing config file for app.
user runs app --config and follows instructions:
Key "A" will be used for "Action A". Press key "A"
Key "B" will be used for "Action B". Press key "B"
keys A and B may not be readable by readln, so they are read directly from '/dev/input/'
while user presses A and B, they are kept in buffer, and this is a problem for further readln
EnableDirectRead in my Compatibility.pas
what is oldState in your EnableDirectRead?
this
program project1;
uses
SysUtils, termio, BaseUnix;
var
s: string;
newTIO, oldTIO: Termios;
begin
TCGetAttr(0, oldTIO);
TCGetAttr(0, newTIO);
CFMakeRaw(newTIO);
TCSetAttr(0, TCSANOW, newTIO);
writeln('Program is doing some job, emulating this with sleep');
sleep(5000); //press A
TCSetAttr(0, TCSANOW, oldTIO);
writeln('Now input B');
Readln(s);
writeln('s contains', s);
end.
doesn't work, or maybe I do not understand the idea