Results 1 to 3 of 3

Thread: [RESOLVED] [2.0] New line

  1. #1

    Thread Starter
    Hyperactive Member OMITT3D's Avatar
    Join Date
    Mar 2006
    Posts
    368

    Resolved [RESOLVED] [2.0] New line

    In notepad if I use "\r" it looks like this:
    Z:\Musak\ACDC - Back In Black.mp3
    Z:\Musak\ACDC - Big Balls.mp3
    Z:\Musak\ACDC - Dirty Deeds Done Dirt.mp3
    Z:\Musak\ACDC - Hells Bells.mp3

    In wordpad:
    Z:\Musak\ACDC - Back In Black.mp3 Z:\Musak\ACDC - Big Balls.mp3 Z:\Musak\ACDC - Dirty Deeds Done Dirt.mp3 Z:\Musak\ACDC - Hells Bells.mp3


    \n in word pad does:
    Z:\Musak\ACDC - Back In Black.mp3

    Z:\Musak\ACDC - Big Balls.mp3

    Z:\Musak\ACDC - Dirty Deeds Done Dirt.mp3

    Z:\Musak\ACDC - Hells Bells.mp3

    and in note pad it leaves like ascii char 13 or something on the end of each line. What is with this how can I make it look good in all text editors..

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

    Re: [2.0] New line

    The proper line break sequence for Windows text files is a carriage return followed by a line feed. The escape character for a carriage return is '\r' and the escape character for a line feed is '\n', thus the proper escape sequence for Windows text files is "\r\n". I tested that and it looked the way it should in both Notepad and WordPad. Note also that if you have a string array you could use the IO.File.WriteAllLines method and avoid line breaks and StreamWriters yourself altogether.
    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

  3. #3
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403

    Re: [2.0] New line

    You might also just grab the value of the Environment.NewLine string and use that -- it will return whatever the appropriate new line character(s) are for whatever platform your program is currently running on.
    Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.

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