O Orejana Member Aug 6, 2018 #1 I'm quite new to coding and I have never worked with saving stuff into an external file before. I want to save multiple things to one line, e.g. temperature and date, "32", "08/06/18" or similar to that. I can't seem to figure out which text file method to use, can someone help me please? Thanks a lot!
I'm quite new to coding and I have never worked with saving stuff into an external file before. I want to save multiple things to one line, e.g. temperature and date, "32", "08/06/18" or similar to that. I can't seem to figure out which text file method to use, can someone help me please? Thanks a lot!
supriono Member Licensed User Longtime User Aug 6, 2018 #3 maybe like this Code: Copy temp="32" time="08/06/18" save("log.Text",temp&","&time) Sub save(namefile As String,value As String) File.WriteString(File.DirTemp,namefile,value) End Sub Upvote 0
maybe like this Code: Copy temp="32" time="08/06/18" save("log.Text",temp&","&time) Sub save(namefile As String,value As String) File.WriteString(File.DirTemp,namefile,value) End Sub
O Orejana Member Aug 6, 2018 #4 supriono said: maybe like this Code: Copy temp="32" time="08/06/18" save("log.Text",temp&","&time) Sub save(namefile As String,value As String) File.WriteString(File.DirTemp,namefile,value) End Sub Click to expand... Thanks for your replies! I tried it like this, but didn't know how to retrieve this data separately lateron. Any tipps for that? Upvote 0
supriono said: maybe like this Code: Copy temp="32" time="08/06/18" save("log.Text",temp&","&time) Sub save(namefile As String,value As String) File.WriteString(File.DirTemp,namefile,value) End Sub Click to expand... Thanks for your replies! I tried it like this, but didn't know how to retrieve this data separately lateron. Any tipps for that?
supriono Member Licensed User Longtime User Aug 6, 2018 #5 Orejana said: Thanks for your replies! I tried it like this, but didn't know how to retrieve this data separately lateron. Any tipps for that? Click to expand... Code: Copy open("log.txt") Sub open(namefile As String) Dim x As String x=File.ReadString(File.DirTemp,namefile) temp=x.SubString2(0,1) time=x.SubString(3) End Sub Upvote 0
Orejana said: Thanks for your replies! I tried it like this, but didn't know how to retrieve this data separately lateron. Any tipps for that? Click to expand... Code: Copy open("log.txt") Sub open(namefile As String) Dim x As String x=File.ReadString(File.DirTemp,namefile) temp=x.SubString2(0,1) time=x.SubString(3) End Sub
Erel B4X founder Staff member Licensed User Longtime User Aug 6, 2018 #6 Why does it need to be a text file? You can use StringUtils.LoadCSV / SaveCSV to create CSV files. Upvote 0
O Orejana Member Aug 6, 2018 #7 Erel said: Why does it need to be a text file? Click to expand... It actually doesn't, thanks for that tip :-D Saving works fine now, but if I want to log the loaded CSV, I only get: (ArrayList) [[Ljava.lang.String;@408efbe8, [Ljava.lang.String;@5ad11920, [Ljava.lang.String;@78285dd6] What did I do wrong? Code: Copy table2 = su.LoadCSV(File.DirApp, "2.csv", ",") Log(table2) Upvote 0
Erel said: Why does it need to be a text file? Click to expand... It actually doesn't, thanks for that tip :-D Saving works fine now, but if I want to log the loaded CSV, I only get: (ArrayList) [[Ljava.lang.String;@408efbe8, [Ljava.lang.String;@5ad11920, [Ljava.lang.String;@78285dd6] What did I do wrong? Code: Copy table2 = su.LoadCSV(File.DirApp, "2.csv", ",") Log(table2)
Erel B4X founder Staff member Licensed User Longtime User Aug 6, 2018 #8 Code: Copy For Each Row() As String In table2 Log(Row(0)) Next Upvote 0
O Orejana Member Aug 6, 2018 #9 Wonderful, thank you very much for the quick & helpful replies! Upvote 0