Please help how to read data from text file
Posted: Sat Jun 22, 2013 7:13 am
Dear Livecode gurus.
I have managed to do the following where I now can get 4 fields from my main stack to be saved
into a text file on the desktop based on the below codes thanks to everyone that help wit their ideas
from the above I get the following on my vr.txt file as per below
samkevin0202384qa
if possible how do I get the fields in the text file to show the below
sam,kevin,0202384,qa
I tried using the delimiter option but some how it did not work as I am sure I am using it the wrong way.
Also, I have managed to read the vr.txt by clicking a button as per below code file but I am having problem as I only know how to read these back to only one field called Varray below.
what I need is to read the vr.txt file back to the individual fields in the main stack that produce the data initially.
the number of fields for my demo will be below 100 fields. for testing purposes I am using only 4 as above.
Really appreciate if the livecode gurus can help me move forward in my coding.
Thank you very much
subas
I have managed to do the following where I now can get 4 fields from my main stack to be saved
into a text file on the desktop based on the below codes thanks to everyone that help wit their ideas
Code: Select all
on mouseUp
put specialFolderPath("desktop") & "/vr.txt" into myFile
open file myFile for write
write fld "name" to file myFile
write fld "foname" & return to file myFile
write fld "staffno" to file myFile
write fld "dept" & return to file myFile
close file myFile
end mouseUp
samkevin0202384qa
if possible how do I get the fields in the text file to show the below
sam,kevin,0202384,qa
I tried using the delimiter option but some how it did not work as I am sure I am using it the wrong way.
Also, I have managed to read the vr.txt by clicking a button as per below code file but I am having problem as I only know how to read these back to only one field called Varray below.
what I need is to read the vr.txt file back to the individual fields in the main stack that produce the data initially.
Code: Select all
on mouseUp
open file specialFolderPath("desktop") & "/vr.txt"
read from file specialFolderPath("desktop") & "/vr.txt" until EOF
put it into fld "vArray"
close file specialFolderPath("desktop") & "/vr.txt"
end mouseUp
Really appreciate if the livecode gurus can help me move forward in my coding.
Thank you very much
subas