Skip to content
Advertisement

In Linux, are there any functions similar to CreateConsoleScreenBuffer/ReadConsoleOutput to read the terminal contents?

That is, how to create a new screen buffer and read/ write buffer contents in Linux? The screen buffer I am talking about refers to the content displayed to the user. Or the entire screen.

I don’t want to use ncurses. I found terminfo, but I want a function instead of an command. Perhaps ioctl can read the buffer, but I don’t know how to use it.

Advertisement

Answer

No

It is given that the user program will maintain a buffer of all screen content it wishes to preserve.

This is actually how NCurses works: All output functions actually modify the WINDOW buffer, and wrefresh() causes that buffer to be flushed to the display, as needed.

The Microsoft roadmap for the Windows Terminal expects future TUI programs to do the same, since that is how it works in Linux, I guess.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement