Need code example for filename variable

jmeuse2

Member
Licensed User
Longtime User
I'm going blind trying to make a variable contain a filename. I Dim 'filename' As String in Sub Process Globals but it keeps pausing on this line...


B4X:
Reader.Initialize(File.OpenInput(File.DirAssets,"filename" & ".txt"))

I'm a card carrying newb groveling for every penny to make a dollars worth of programming.
 

NJDude

Expert
Licensed User
Longtime User
Try this:
B4X:
Dim FileName As String

...

FileName = "MyFile"

Reader.Initialize(File.OpenInput(File.DirAssets, FileName & ".txt"))

I'm assuming you have a file named MyFile.txt in your assets.
 
Upvote 0
Top