ActiveState Community

How to flush STDIN in TCL?

Posted by krishnan_tom on 2008-02-25 21:07
OS: All / Any

hello,
I would like to know the tcl command to flush STDIN buffer.

Thank you

jeffh | Tue, 2008-02-26 10:58

stdin in controlled more by the pushing process, and that is what should flush it. You can fconfigure stdin to have no buffering, but you otherwise need something like Expect to have better raw control over std channels (if they are ttys).

krishnan_tom | Tue, 2008-02-26 20:50

Thanks for the reply ,
I have tried no buffering option with the fconfigure, but it didn't work.
I tried one more solution i.e. non blocking mode with fconfigure. it will read the characters in the buffer when it returns null, I again reconfigured the fconfigure to blocking mode, and it is working.