Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a telnet server coded in C#, and I am trying to send text that is colorized to the client. This should be pretty trivial, but as it turns out it's not wanting to work.

 

Here's how it works:

 

For red foreground color you would send "\033[31m" to the telnet client. "\033" is the hex code for the Esc key I believe.

 

Now, this worked fine and dandy back in my C++ days but for some reason C# is ignoring the entire escape code. It sees "\0" and interprets it as null, instead of looking at the whole "\033".

 

Basically, I need to force it to look at the whole code and not just the \0. I am completely stumped at this point.

 

To recap, I need it to interpret "\033" as a whole, and not as "\0 33".

 

Thanks,

Bartman

Posted

I don't know much of C# but maybe the problem is solved replacing the "\033" to "\\033" did you try that?

 

 

I also heard that C# has a new feature with strings that if you put before the string an @ it will be taken without escape characters or something like that im not sure about the last thing but you can try like @"\033".

 

 

--

Bye,

Ronq.

Posted

Hey RonQ,

 

Thank you for your reply. The @ character is for the string literal, which is exactly what you described. However, the problem is that \033 IS an escape code :confused: It represents pushing the Esc key on your keyboard, much like \b represent's pushing backspace.

 

Putting the extra slash in has the same effect as the @ string literal :-\

 

Anyone else have any ideas how to make it evaluate '\033' has a whole and not as null followed by 33?

 

Thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...