Answer the question
In order to leave comments, you need to log in
How to make the waiting for a keypress to occur in parallel with the data update?
I need to implement a simple chat emulator. To do this, you need to update the message buffer in a loop and, if there is a new one, display it on the screen. At the same time, you need to be able to enter a message yourself and put it in the buffer, as well as the ability to exit the loop, for example, by pressing Esc.
The principle should be like this:
while(1)
{
//если есть новое сообщение, вывести его на экран
//если пользователь вводит сообщение (или нажимает Esc), обработать это действие
//иначе, перейти к след. итерации
}
Answer the question
In order to leave comments, you need to log in
Multi-threading will save you.
Here it’s still over to look at what you draw the GUI with, maybe you can somehow implement it in it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question