|
-
May 19th, 2004, 09:58 AM
#1
Thread Starter
Frenzied Member
ascii representations [RESOLVED]
In vb, you can create a string and include chr(13) to represent an Enter keystroke. I checked out the threads on this here but they don't work.
I tried the convert.tostring(13) and it's not working. Is there a namespace I need to use in order to be able to send an Enter keystroke?
Last edited by Andy; Aug 13th, 2004 at 12:08 PM.
-
May 19th, 2004, 10:08 AM
#2
Addicted Member
In vb you can also use vbCr as Character 13 aka carrage return.
In C# \r represents carrage return in a string
Additional info:
\t is tab
\n is new line
\0 is null
-
May 19th, 2004, 10:30 AM
#3
Thread Starter
Frenzied Member
that doesn't seem to work either. I get an 'invalid token' error.and '; expected' error.
does the \r need to be INSIDE the quotes?
-
May 19th, 2004, 11:02 AM
#4
you can use char 13 or add \r inside the string , eg:
Code:
char c = (char)13;
string s = "test" + c.ToString() + "123";
Console.WriteLine(s);
// or to use Return in a string ...
Console.WriteLine("test\r123");
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
May 19th, 2004, 09:21 PM
#5
PowerPoster
System.Environment.Newline
Use that^
-
May 19th, 2004, 11:41 PM
#6
Thread Starter
Frenzied Member
Originally posted by hellswraith
System.Environment.Newline
Use that^
will that work when sending a string as a command to a telnet server? I have to send a message and an 'enter' to execute it.
What really stinks about this is, I can't test anything until everything is compiled. I don't know enough about the language yet to make it seamless enough between debugging stages.
-
May 20th, 2004, 06:36 AM
#7
yay gay
put like this
Code:
string myString = "hi\nbye";
or
Code:
string myString = "hi\r\nbye";
or like hellswraith said
Code:
string myString = "hi" + Environment.NewLine + "bye";
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|