A Andie Member Licensed User Longtime User May 8, 2017 #1 When running in the debug mode the text file myList.txt is not found and the message box is displayed. In release mode there's no problem. I have no idea, why. Here's the code: Code: If File.Exists(File.DirAssets, "myList.txt") Then Dim tr As TextReader tr.Initialize2(File.OpenInput(File.DirAssets, "myList.txt"), "ISO-8859-1") datalist = tr.ReadList tr.Close Else Msgbox("myList.txt is missing","Attention!") End If
When running in the debug mode the text file myList.txt is not found and the message box is displayed. In release mode there's no problem. I have no idea, why. Here's the code: Code: If File.Exists(File.DirAssets, "myList.txt") Then Dim tr As TextReader tr.Initialize2(File.OpenInput(File.DirAssets, "myList.txt"), "ISO-8859-1") datalist = tr.ReadList tr.Close Else Msgbox("myList.txt is missing","Attention!") End If
Erel B4X founder Staff member Licensed User Longtime User May 8, 2017 #2 In most cases it is a mistake to use TextReader or TextWriter. Use File.ReadList instead. Why do you check whether the file exists? If you added it to the project then it will always be there. Upvote 0
In most cases it is a mistake to use TextReader or TextWriter. Use File.ReadList instead. Why do you check whether the file exists? If you added it to the project then it will always be there.
A Andie Member Licensed User Longtime User May 8, 2017 #3 Thanks, Erel. I skipped the File.Exists command - and it works fine. I used TextReader instead of File.ReadList because of the German "Umlaute". After my opinion I cannot enable ISO-8859-1 in File.ReadList. But may be, I'm wrong ... Upvote 0
Thanks, Erel. I skipped the File.Exists command - and it works fine. I used TextReader instead of File.ReadList because of the German "Umlaute". After my opinion I cannot enable ISO-8859-1 in File.ReadList. But may be, I'm wrong ...
DonManfred Expert Licensed User Longtime User May 8, 2017 #4 You should save the file in your assets using UTF8 Encoding.... If not specified B4A will use UTF8 Upvote 0
A Andie Member Licensed User Longtime User May 8, 2017 #5 DonManfred said: You should save the file in your assets using UTF8 Encoding.... If not specified B4A will use UTF8 Click to expand... Yes - good idea. Thanks! Upvote 0
DonManfred said: You should save the file in your assets using UTF8 Encoding.... If not specified B4A will use UTF8 Click to expand... Yes - good idea. Thanks!