Resolved: make a user input with text before wich works even if printing from another thread

In this post, we will see how to resolve make a user input with text before wich works even if printing from another thread

Question:

I am trying to make a python like user input in wich you can print to the screen from one thread, while waiting for an input from another thread
for example when I do something like this:
and at the same time from another thread I do something like this:
I get something like this:
but I want to get something like this:
can you help me to do it

Best Answer:

Standard C++ cannot rearrange text already on the terminal. You’ll need a helper library that knows how to do complex iteractions with the specific terminals of various operating systems, such as ncurses

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com