1. RE: sequences read from file
First off, you have to be sure your file has been written with the
proper Euphoria object syntax:
{{00,10,01},{"ç",3,"text"},{"#",5,"text"}
{"ç",1500,"text3"},{"#",1600,"text4"}
{"ç",1500,"text5"},{"#",1600,"text6"}}
{{00,10,02},{"ç",3,"text"},{"#",5,"text"}
{"ç",1500,"text3"},{"#",1600,"text4"}
{"ç",1500,"text5"},{"#",1600,"text6"}}
is not in correct form, as many delimiting commas are missing.
A corrected version looks like this:
{{00,10,01},{"ç",3,"text"},{"#",5,"text"},
{"ç",1500,"text3"},{"#",1600,"text4"},
{"ç",1500,"text5"},{"#",1600,"text6"}}
{{00,10,02},{"ç",3,"text"},{"#",5,"text"},
{"ç",1500,"text3"},{"#",1600,"text4"},
{"ç",1500,"text5"},{"#",1600,"text6"}}
Correct object form is paramount to success with the get() command.
Probably the best way to insure correct form is to write the file
with Euphoria only.
Secondly, you will want to use the 'get()' command, not
the 'gets()' command.
Thirdly, when using the get() command, you actually get
a sequence of two objects:
The first object tells you if the object in the file was
a valid Eu object and was read correctly.
The second object is the actual object in the file, provided
it was free from errors.
Here's a quick test program you can run. The file was created
with the 'corrected' data version above, and was named 'file.txt'.
Note variable 'line' is declared as object, not sequence!
--START OF CODE------------------------
with trace
atom ink
include get.e
include file.e
trace(1)
atom fn
object line,lineB
fn=open("c:\\euphoria\\quicktests\\file.txt","r")
if fn>1 then
line=get(fn)
if line[1]=GET_SUCCESS then -- object has been read ok
lineB=line[2]
else
lineB=""
end if
?lineB
end if
close(fn)
ink=wait_key()
--END OF CODE--------------------------