Answer the question
In order to leave comments, you need to log in
How to shift user input in C (console, multithreading)?
In simple terms: there are two threads, one leaves messages, the second waits for user input in the same console. How to make the user input line shift when a message arrives.
Answer the question
In order to leave comments, you need to log in
Protect console output with a mutex: grab it before printing lines to the screen from the second stream and release it immediately after.
When a character appears in the keyboard buffer (_kbhit() became true):
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question