Hi and please help with this problem
1) I have several text files, each one is containing a known number of strings
2) I declare some arrays as
Dim Elements1 as int: Elements1 = value1
Dim MyStringArray1( Elements1 ) As String
Dim Elements2 as int: Elements2 = value2
Dim MyStringArray2( Elements2 ) As String
......
Dim ElementsN as int: ElementsN = valueN
Dim MyStringArrayN( ElementsN ) As String
3) I want to have a single sub for reading text files and filling the corresponding string array. So i tried this and this don't work:
When I try to use this SUB
UniversalReader( MenuImages(), "menu.txt" )
I got the compiler error:
Error compiling program.
Error description: Missing parameter.
Occurred on line: 646
UniversalReader( MenuImages(), "menu.txt" )
Word: (
What I'm doing wrong ?
1) I have several text files, each one is containing a known number of strings
2) I declare some arrays as
Dim Elements1 as int: Elements1 = value1
Dim MyStringArray1( Elements1 ) As String
Dim Elements2 as int: Elements2 = value2
Dim MyStringArray2( Elements2 ) As String
......
Dim ElementsN as int: ElementsN = valueN
Dim MyStringArrayN( ElementsN ) As String
3) I want to have a single sub for reading text files and filling the corresponding string array. So i tried this and this don't work:
B4X:
Sub UniversalReader( MyArray() As String, Myfile as String)
Dim counter As Int
counter = 0
Dim TextReader1 As TextReader
TextReader1.Initialize( File.OpenInput( File.DirAssets, MyFile ) )
Dim line As String
line = TextReader1.ReadLine
MyArray( counter ) = line
counter = counter + 1
Do While line <> Null
line = TextReader1.ReadLine
MyArray( counter ) = line
counter = counter + 1
Loop
TextReader1.Close
End Sub
When I try to use this SUB
UniversalReader( MenuImages(), "menu.txt" )
I got the compiler error:
Error compiling program.
Error description: Missing parameter.
Occurred on line: 646
UniversalReader( MenuImages(), "menu.txt" )
Word: (
What I'm doing wrong ?