WriteLine problem

ranba790

Member
Licensed User
Longtime User
Hi
i am running this code on an emulator

Dim Writer As TextWriter
Writer.Initialize(File.OpenOutput(File.DirDefaultExternal, "1.txt", False))
Writer.WriteLine("This is the first line.")
Writer.WriteLine("This is the second line.")
Writer.Close

when i upload the file to the pc and open it in notepad all text shows in one line

any idea why

thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
any idea why
Yes. Android (linux) end of line character is chr(10). Windows end of line characters are chr(13) & chr(10).

You can change your code to:
B4X:
Writer.Write("..." & chr(13) & chr(10))
Or you can download a more powerful text editor like notepad++ (highly recommended): Notepad++ | 5.9
This editor knows how to deal with different formats and it also shows you the actual characters.
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
Yes. Android (linux) end of line character is chr(10). Windows end of line characters are chr(13) & chr(10).

You can change your code to:
B4X:
Writer.Write("..." & chr(13) & chr(10))
Or you can download a more powerful text editor like notepad++ (highly recommended): Notepad++ | 5.9
This editor knows how to deal with different formats and it also shows you the actual characters.
Surely that should be:
B4X:
Writer.Write("..." & chr(13) )
as chr(10) will be appended anyway?
 
Upvote 0
Top