1

Here is a sample string I got off a socket stream.

\033[H\033[J\033[1;30HSUPERVISOR MAIN MENU\033[6;5H 0.  Exit         Exit\033[7;5H 1.  Help         Display help\033[8;5H 2.  Control      Calling lists and users\033[9;5H 3.  Campaign     Campaigns\033[10;5H 4.  Manage  

If you want to see the output I expect open a unix/linux shell, type echo -e followed by a space followed by the above string in single quotes and hit Enter key. The output appears something like:

                     SUPERVISOR MAIN MENU


 0.  Exit         Exit
 1.  Help         Display help
 2.  Control      Calling lists and users
 3.  Campaign     Campaigns
 4.  Manage

I want the same output except it should be in memory...I require to work with it later...any ideas.

2
  • just curious... whose socket stream? and why were you looking at it? Commented Nov 25, 2009 at 2:13
  • just opened a socket which connects to one of our unix boxes. We r just interested in the data we receive from it...based on whats there we want to issue commands... Commented Nov 25, 2009 at 12:54

1 Answer 1

1

I asked an almost equivalent question a few hours ago: Open Source C# VT100 Server. You want a client library that understands the vt100 escape commands.

I searched around for a while and to date haven't found any very good vt100 C# libraries. I've gotten started on a custom one and since I really only need to interpret left and right arrows and backspace it hasn't taken long.

Luckily the vt100 standard is very promiscuous and not overly complex. I don't think it would take you very long to whip up some code to understand the escape commands in your example. This link has a nice concise list of the VT100 escape sequences (you need to scroll down a bit). Another good site is vt100.net.

In your example the escape sequences are being in octal. Your first escape sequence is:

\033[H

which translates to the ASCII below and is used to set the cursor position.

ESC [ H

The second one is

\033[J

which translates to the ASCII sequence below and means clear the line to the end of screen.

ESC [ J 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.