Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line Breaks in a Text File 1

Status
Not open for further replies.

jaredn

Programmer
Sep 1, 1999
1,506
US
I have experienced much difficulty in forcing a text file that I write to include (visible) line breaks. When I open the file in 'Notepad', the supposed line breaks appear as odd rectangluar symbols, and do not force a carraige return.

I have attempted to solve this problem with the following techniques:

- Appending a '\n' to the end of each line's string
- Appending a String.fromCharCode(13)
- Appending a '\r\n' to the end of each line's string

Can anyone help me, please?
jared@eae.net -
 
Hi

The character you will be seeing will be either a carriage return (10) or line feed (13) character. Somtimes you can get away with just one, but it is always best to use the two of them together.

You mentioned adding "\n" which means you are using javascript. If you are using vbscript it is a lot easier. For a newline use the VB variable

vbCrLf

This will give both a "C"arriage "R"eturn and a "L"ine "F"eed and will guarantee correct output on a Mac and a PC Derren
[The only person in the world to like Word]
 
Thank you so much. I just had to use both of the characters together with this technique:

break = String.fromCharCode(13) + String.fromCharCode(10) jared@eae.net -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top