Page 1 of 1

program buffer or a keyboard buffer

Posted: Thu Feb 05, 2015 3:18 pm
by Otto
Hello,

I try to find out how I can read a keyboard buffer.

This is what I found so far. Can someone help me to with a fivewin solution.
so if there is a command line and there is a text in it and waiting for an 'enter' to be pressed in which buffer does it stay?,in a program buffer or a keyboard buffer?

It depends on the platform, but for example on a .NET console app running on Windows, if you call Console.ReadLine() while the app has focus it is going to receive the keyboard input and store it in an application level buffer. The only time it would stay at a lower level buffer is if the system is too busy to process the input in time. At this level 'buffering' is really just a semantic concept; the system is basically at rest, the input has been processed, transformed into a UTF-8 string and stored in memory waiting to be returned to your program when the enter key is detected.
Best regards,
Otto

Re: program buffer or a keyboard buffer

Posted: Sat Feb 07, 2015 2:59 am
by Antonio Linares
Otto,

keyboard pressed chars will automatically arrive to the app as Windows messages, so there is no need to access the keyboard buffer.

In case that you want to check in advanced (before those messages come to you) what is there is the buffer you can use PeekMessage()

https://msdn.microsoft.com/en-us/librar ... 85%29.aspx