Home > front end >  Is ANSI standard and portable for terminals?
Is ANSI standard and portable for terminals?

Time:12-24

I have a program in C where I want to draw colors and move cursors, etc. in the terminal. Currently, I am just using ANSI escape codes to do this. Is ANSI the most modern and most popular/used standard? Is it portable? Will more or fewer terminals support ANSI in the future?

CodePudding user response:

Modern terminal emulators (just about anything normal people will encounter these days) all tend to use stuff you can find documented in two places:

Microsoft’s “Console Virtual Terminal Sequences”

Thomas Dickey’s “XTerm Control Sequences”

It doesn’t get more authoritative than that.

CodePudding user response:

I'd say that ANSI is going to be pretty reliably portable for some time to come.

However, it's possibly more productive and more protected from changes in underlying standards (e.g. a resurgence of PC3270) to use a library. There's an enormous list of them here, under the Libraries section. Ncurses seems to be something of a staple, and notcurses has a lot of merit too.

  • Related