B4J Question Problem reading a text file

kohle

Active Member
Licensed User
Longtime User
Hi,
I have a text file : config.txt with some parameters like

mdb=C:\TEST-aktuell\TEST-aktuell.mdb

I read with :

B4X:
config = File.ReadMap(File.DirApp, "config.txt")
Mdb=config.Get("mdb")


The result is :
C:TEST-aktuellTEST-aktuell.mdb

What I do wrong ?
 

drgottjr

Expert
Licensed User
Longtime User
you either need to escape the "\" or to use "/"
mdb=C:\\TEST-aktuell\\TEST-aktuell.mdb
mdb=C:/TEST-aktuell/TEST-aktuell.mdb
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
not really necessary to make up his own rules; all he had to do was follow the spec. assuming all the lines of his config file were like the ones show, it is a map in the eyes of java. whether he knew it or not. the file could be read either way, but as a map, the spec requires escaping. i've made a notation in my moleskine notebook of tricks.
 
Upvote 0
Top