Some of the linux commands like less or man display their output in the current terminal occupying the whole screen. But the previous interactions reappear as is once the program quits.
How can we achieve the same behavior for our custom program?
Thank you.