Results 1 to 7 of 7

Thread: ascii representations [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    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.

  2. #2
    Addicted Member
    Join Date
    Jun 2003
    Location
    Birmingham, AL
    Posts
    188
    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

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    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?

  4. #4
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    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]

  5. #5
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    System.Environment.Newline

    Use that^

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    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.


  7. #7
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    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
  •  



Click Here to Expand Forum to Full Width