c++ - How to prevent input text breaking while other thread is outputting to the console? -


i have 2 threads: 1 of them cout'ing console value, let's increments int value every second - every second on console 1,2,3... , on.

another thread waiting user input - command cin.

here problem: when start typing something, when time comes cout int value, input gets erased input field, , put console int value. when want type in "hello" looks this:

1 2 3 he4 l5 lo6 7 8 

is there way prevent input getting put console, while other thread writing console?

fyi needed chat app @ client side - 1 thread listening messages , outputs message comes in, , other thread listening user input sent server app.

usually terminal echos keys typed. can turn off , program echo it. question give pointers on how hide password input on terminal

you can 1 thread handle output.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -