Isolation of stdin and stdout in terminal

I am developing a CLI program in C for my system class project, and it needs to display the incoming text while saving the command line. Left alone, the incoming text will see everything that it is trying to print. In other applications, I saw incoming text print above (or below) an invitation. Is there any way to implement this in ANSI screens? ncurses seems redundant.

+3
source share
2 answers

You can print \rto delete the prompt: it will return the cursor to the beginning of the current line. You can then print your output, followed by some spaces, to remove all remaining input characters, a new line, and retype the prompt.

ANSI , , , , , , ASCII. 242 , , .

: , ANSI . -, , " ". , Windows -XP/ANSI post XP, .

+2

-, , , scanf. , . (n) n-1 , .

my2c

0

Source: https://habr.com/ru/post/1788295/


All Articles