Android Question [SOLVED] File.readlist, first item is empty

alwaysbusy

Expert
Licensed User
The files are created in another language (Xojo on PC). They contain the description of a SQLite database that B4A reads and then uses to create the db.

Only three lines in it:

First line:
<Database>FYTO_Alain.sq3</Database> <-CR

second line:
<Table>FYTO_REGISTRATIE;4,FYTO_REGISTRATIE_SYSID,FYTO_REGISTRATIE_SYSID,0;4, .......</Table> <-CR

Third line:
<Screens>4:27;5:12;6:5;7:26;8:5;9:5;10:11;11:11;16:6;17:6;13:25;12:25;19:19;18:25</Screens> <-CRLF

Code:

Dim txtIN As List
txtIN.Initialize
txtIN = File.ReadList(mGlobal.BuildPath, "CurrentDB.Schema")

Result in txtIN after this code:

txtIN.Get(0)<- the weird empty string
txtIN.Get(1) <Database>FYTO_Alain.sq3</Database>
txtIN.Get(2) <Table>FYTO_REGISTRATIE;4,FYTO_REGISTRATIE_SYSID,FYTO_REGISTRATIE_SYSID,0;4, .......</Table>
txtIN.Get(3) <Screens>4:27;5:12;6:5;7:26;8:5;9:5;10:11;11:11;16:6;17:6;13:25;12:25;19:19;18:25</Screens>
txtIN.Get(4)<- an ampty string, but this one makes sence as there is an CRLF at the end, ergo ReadList makes two lines
 

Troberg

Well-Known Member
Licensed User
My first instinct in cases like these is to check character encoding. Is it one encoding and ReadList expects another?

Otherwise, simplify. Make a simple file (in a texteditor) with, say, A, B, C and D in it, just to make sure there isn't anything you don't see in the data. If this doesn't work, it's probably Erel's problem, if it works, well, then you can gradually do more complex test cases until you find the problem.
 
Top