Hi

I am looking for some information regarding VT102 escape codes. Are there any tutorials on this anyone can recommend?

Basically, what I need to do is overwrite these print statements within the for loop to my screen:

for (int i=0;i<5;i++)
{
printf("Enter the current price of the product: ");
scanf("%d", &price);
printf("Enter the number of the product: ");
scanf("%d", &number);

int total price = price*number;

printf("total price is %d", number)

}

Recommended Answers

All 3 Replies

Are you refering to the old DEC VT102 computer terminal?

If so, just type: "vt102 escape codes" into your faorite search engine. There is lots of info out there.

What TnTinMN said. The VT102 terminal is the foundation of the ANSI terminal type that is what you get in a standard Linux console or the xterm terminal type you get with an X-Windows command-line window. To see what your terminal type is, try the command: echo $TERM

As for escape codes, those are well documented - I actually own a VT102 terminal manual from DEC from the 1980's - I had to write a terminal emulator to handle all terminal types (including ones that weren't VT types) around 1990 for a real-time operating system, which is why I have that resource. In any case, a Google search should come up with the information you need.

BTW, if you want to do this on ALL terminal types, don't inject the VT-specific codes into the printf statements. It is much preferable to use the ncurses library to perform cursor-addressable output to console or xterm windows.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.