The following code is what I am using (been revised numerous times) in trying to write a file so that there is separation between the lines.
The display looks like this and I was hoping the written text file would also.
1 1000 1000 None
2 1027.69920 1030.22837 None
3 1038.56960 1070.79725 None
4 999.93257 1081.15001 None
5 1034.91736 1100.54239 None
6 1082.14682 1126.72211 None
7 1028.14682 1126.72211 None
8 1028.14682 1141.72211 None
9 958.14682 1141.72211 None
10 941.18608 1080.52911 None
However, in notepad it looks like this:
1 1000 1000 None2 1027.699 1030.228 None3 1038.570 1070.797 None4 etc.
1126.722 None8 1028.147 1141.722 None9 . . . . .
(I have rounded the decimals for this illustration) This is what is shown when I look at the file in Notepad.
The weird thing is that when I copied and pasted from notepad, the result was as it should be (shown above with the 10 lines. But a user will only see the points joined together.
In b4ppc I was able to actually write the text display without parsing.
I am using the b4a-bridge with a tablet.
Anyone see anything that can be done differently to get the results I am looking for. I'm afraid a user would be very disappointed at seeing the file in this fashion (everything in a couple of lines). The main reason for the user being able to get a text file is so they could print the results.
Thanks, guys for all of your excellent help.
Jim Schuchert
B4X:
Sub btnOK_click
If chklistdisplay.Checked =True Then
Msgbox("A file named 'List of points.txt' will be created","msg")
Dim writer As TextWriter
writer.Initialize (File.OpenOutput (File.DirrootExternal ,"listofpoints8.txt",True))
End If
If txtrange.Text ="" Then
Dim reader As TextReader
reader.Initialize (File.openinput(File.Dirinternal ,main.strfilename ))
Dim lineoftext As String
Dim cline()
lineoftext=reader.ReadLine
Do While lineoftext<>Null
cline=Regex.Split (",",lineoftext)
txtdisplay.Text =txtdisplay.Text & cline(0) & " " & cline(1) & " " & cline(2) & " " & cline(3) & CRLF
If chklistdisplay.Checked =True Then
writer.Write (cline(0) & " " & cline(1) & " " & cline(2) & " " & cline(3)) '& CRLF
writer.Write (CRLF)
End If
lineoftext=reader.ReadLine
Loop
reader.Close
If chklistdisplay.Checked = True Then writer.Close
End If
The display looks like this and I was hoping the written text file would also.
1 1000 1000 None
2 1027.69920 1030.22837 None
3 1038.56960 1070.79725 None
4 999.93257 1081.15001 None
5 1034.91736 1100.54239 None
6 1082.14682 1126.72211 None
7 1028.14682 1126.72211 None
8 1028.14682 1141.72211 None
9 958.14682 1141.72211 None
10 941.18608 1080.52911 None
However, in notepad it looks like this:
1 1000 1000 None2 1027.699 1030.228 None3 1038.570 1070.797 None4 etc.
1126.722 None8 1028.147 1141.722 None9 . . . . .
(I have rounded the decimals for this illustration) This is what is shown when I look at the file in Notepad.
The weird thing is that when I copied and pasted from notepad, the result was as it should be (shown above with the 10 lines. But a user will only see the points joined together.
In b4ppc I was able to actually write the text display without parsing.
I am using the b4a-bridge with a tablet.
Anyone see anything that can be done differently to get the results I am looking for. I'm afraid a user would be very disappointed at seeing the file in this fashion (everything in a couple of lines). The main reason for the user being able to get a text file is so they could print the results.
Thanks, guys for all of your excellent help.
Jim Schuchert
Last edited: