Question

I have recently been assigned to port an old COBOL program. I am used to GUIs, and I can't understand how a TUI works. I searched a lot through Google but couldn't find something.

I knew that console applications could output line by line, but how are colors etc. drawn to the terminal screen? How all this stuff is being drawn? Do terminals support it somehow? Is there a standard? I am really confused.

Was it helpful?

Solution

Pretty sure your answer is going to vary based on platform here. There are many different types of terminal/console and for many more than one standard for writing to it. Most of them I have seen use some sort of escape sequence (ex: ANSI char escapes for dos, YMMV) where you send a special escape char to interrupt the writing to the screen then you can move the cursor, change colors, etc.

If you are writing something literally for dumb terminals then probably going to be using something like https://secure.wikimedia.org/wikipedia/en/wiki/Ncurses

OTHER TIPS

The generic term for that sort of interface is "command line". You'll probably do better googling for that than for "text user interface".

Don't worry, there are hundreds of standards to choose from :)

I am sadly more comfortable with text- and console-based applications than their older graphical window brethren. Too many days on FidoNet I fear.

The very first thing I would do is learn a few VT100 codes from the old Digital company. You may never write applications in VT100 codes (likely advise against it), but it is a very good and simple introduction to controlling the console matrix.

Libraries such as curses wrap these control codes (and many other style terminal codes) and abstract them so that users can login via their own terminals. Things like VT100 can even do remote (local) printing with which we still struggle today in RDP.

To make things worse for you, IBM systems use not line- or character-based control, but screen- and block-based protocols. Examples are the 3270 and 5250 terminal protocols which for the lack of a better comparison act in the request|response architecture think HTTP. As capable as these are, they are a true PITA IMNSHO with which to work and should be their own separate question.

Worse than that would be writing a console application in a DOS/Windows world. Do reply with your target development platform.

Licensed under: CC-BY-SA with attribution
scroll top