Hi
Thanks to all for replies. I attach the file that I am reading. The code that I use is the following: (sorry, I don't remember how to insert code in message). Moreover this is not working code, but just the involved parts. This should clarify what I mean. By the way I also do a thing on which I am not sure, despite it is not related to the issue. I should open another thread: I start declaring global variable arrays with no size, and I give them a dimension during reading the file.. I am used to work in C/C++ and I don't know exactly how B4A works on this.. but, as I said, this is another question. Thanks for now.
Sub Process_Globals
Type Pozzetto( Nome As String, _
p As Double, _ ' progressiva
x As Double, _
y As Double, _
z As Double, _
q1 As Double, _
q2 As Double, _
d As Float, _
h1 As Float, _
h2 As Float, _
hf As Float, _
hs As Float, _
desc As String)
Type TipoBase( Nome As String, Codice As Short)
End Sub
Sub Globals
Dim TipPoz() As TipoBase
Dim Reti() As TipoBase
Dim FonInfo() As TipoBase
Dim Sistemi() As TipoBase' sistema
Dim MatCol() As TipoBase ' materiale collettore
Dim TipSec() As TipoBase ' tipo sezione
Dim TipCop() As TipoBase ' tipo cobertura
Dim ModIns() As TipoBase ' modo inserção
Dim TipQue() As TipoBase ' tipo queda
Dim DisAcc() As TipoBase ' dispositivos acesso o Tipo Acesso??
Dim FabFec() As TipoBase ' fabricates fecho
Dim Classe() As TipoBase ' classe fecho
Dim ForFec() As TipoBase ' forma fecho
Dim Fregue() As TipoBase ' freguesia !!! sommare 1111 ossia 01 diviene 111101 e 27 -->> 111127
Dim TipRam() As TipoBase ' tipo ramal
Dim EntPro() As TipoBase ' entitá promotrice
Dim Respon() As TipoBase ' Responsabile
Dim Diamet() As TipoBase ' diametri
Dim MatFec() As TipoBase ' material fecho
Dim MatSat() As TipoBase
End Sub
Sub LeggeCategorieIdraulica
If File.Exists(File.DirRootExternal, "FolderWhereTheFileIs/ListaCaixaN_UTF8.txt") Then
Dim TextReader1 As TextReader
TextReader1.Initialize(File.OpenInput(File.DirRootExternal, "FolderWhereTheFileIs//ListaCaixaN_UTF8.txt"))
LeggeTipi(TextReader1,TipPoz)
LeggeTipi(TextReader1,Reti)
LeggeTipi(TextReader1,FonInfo)
LeggeTipi(TextReader1,Sistemi)
LeggeTipi(TextReader1, MatCol)
LeggeTipi(TextReader1,TipSec)
LeggeTipi(TextReader1,TipCop)
LeggeTipi(TextReader1,ModIns)
LeggeTipi(TextReader1,TipQue)
LeggeTipi(TextReader1, DisAcc)
LeggeTipi(TextReader1, FabFec)
LeggeTipi(TextReader1, Classe)
LeggeTipi(TextReader1, ForFec)
LeggeTipi(TextReader1,Fregue)
LeggeTipi(TextReader1,TipRam)
LeggeTipi(TextReader1,EntPro)
LeggeTipi(TextReader1,Respon)
LeggeTipi(TextReader1,Diamet)
LeggeTipi(TextReader1,MatFec)
LeggeTipi(TextReader1, MatSat)
TextReader1.Close
End If
End Sub
Sub LeggeTipi(TextReader1 As TextReader,Lista() As TipoBase)
Dim i,p,n As Int,s As String,tip As TipoBase
n=TextReader1.ReadLine
Dim Lista(n) As TipoBase
For i=0 To Lista.Length-1
s=TextReader1.ReadLine.Trim
p=s.LastIndexOf(" ")
tip.Initialize
tip.Nome=s.SubString2(0,p-1)
tip.Codice=s.SubString(p-1)
Lista(i)=tip
Next
End Sub