How to insert New Line for text file ?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: How to insert New Line for text file ?

  1. #1
    Join Date
    Dec 1999
    Posts
    18

    How to insert New Line for text file ?

    I using FileWriter to write a string to text file and open using windows notepad.

    e.g.
    write("This is new line");
    write("\n"); // or using write("\r");

    when i run this for 2nd time, the output should be view as below in the windwos notepad :-

    This is new line
    This is new line

    but in the windows notepad, what i see is :-
    This is new line#This is new line

    # = square bracket (sorry i can't draw square bracket here)

    For others Text Editor, is work just fine. Only Windows Notepad got this problem.

    Anyone know what the windows notepad newline format ? is that an ASCII for ENTER key ? and what is the ASCII for ENTER key ? or ?

    Please help. Thanks.


  2. #2
    Join Date
    Dec 1999
    Posts
    18

    Re: How to insert New Line for text file ?

    Hi,
    I managed to solved the problem.

    just include the /r/n together.
    e.g
    write("This is new line");
    write("\r\n");

    Thanks.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center