Results 1 to 5 of 5

Thread: [RESOLVED] wierd output

  1. #1

    Thread Starter
    Fanatic Member popskie's Avatar
    Join Date
    Jul 2005
    Location
    In my chair
    Posts
    666

    Resolved [RESOLVED] wierd output

    hi,
    Look at the code below and corresponding output.
    VB Code:
    1. System.Console.Write("Invalid string "+ Convert.ToChar(13) + " Test");

    output.
    Testid string

    Anyone can explain ?

    edit

    never mine this I just got it.

    thanks,

  2. #2
    Hyperactive Member vbcode1980's Avatar
    Join Date
    Nov 2005
    Location
    Anywhere the wind blows
    Posts
    365

    Re: [RESOLVED] wierd output

    That's really weird..

    I tried it with a few different strings, and found out really weird stuff.
    Appearantly the Convert.ToChar(13) causes the console to go back to the beginning of the line and write the second string. So the second string overwrites the first one.
    I code C#....

  3. #3

    Thread Starter
    Fanatic Member popskie's Avatar
    Join Date
    Jul 2005
    Location
    In my chair
    Posts
    666

    Re: [RESOLVED] wierd output

    change 13 to 10 so that console will go to the next line. but in delphi before i used 13 and no issue.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] wierd output

    13 is a carriage return and 10 is a line feed. They are based on old type-writers. I'm not sure whether you guys are youngsters and don't remember them but if you were using a type-writer and you returned the carriage without feeding the paper to the next line then you'd simply write over the top of the last line. What you're seeing with that output is EXACTLY what those two control characters were designed to do.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Hyperactive Member vbcode1980's Avatar
    Join Date
    Nov 2005
    Location
    Anywhere the wind blows
    Posts
    365

    Re: [RESOLVED] wierd output

    I'm a bit of a youngster, but I remember typewriters
    Cool to know
    I code C#....

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