I am making a chat application for my homework which runs within a Linux Terminal. So, I need to take from the user some input and display the output from all the users as well in a well organized manner. So, I made two threads. One thread have a cin command and the other thread is having a display function which basically uses printf to sequentially print the chat messages.
But the problem is that I am not able to give the input properly because as soon as I start writing something on the terminal it moves the focus/cursor to the next line it prints.
One way that I was able to figure out is use gotoXY function in the thread with the cin statement. But what I was not able to figure out in this way is how to print the chat messages sequentially.