Re: Reading a file into a "sequence"
- Posted by Tommy Carlier <tommy.carlier at telenet.be> Nov 18, 2004
- 534 views
John F Dutcher wrote: > > You guys do a heck of a job... > The sub routine is a nice piece of work.... > This is returned in "ex.err" when called with the input below & > the code lines below: > > "sequence lengths are not the same (4 != 0)" > > This seems to refer to line (12) of "CSV_to_Sequence(object pText)" > > > }}} <eucode> > sequence Fields > > fn=open("tml_extract.txt","r") > if fn < 1 then > puts(1, "Unable to open the disk file\n") > abort(fn) > else > while 1 do > Fields = CSV_to_Sequence( gets(fn)) > if Fields = {} then exit > else ..... > -- etc. etc. > </eucode> {{{ > > The first record in "tml_extract.txt" is: > (and does seem to contain (4) "fields") > > "%HDR","EXTRACT","11/17/2004 02:23:10 AM","UNIVERSITY OF ROCHESTER MEDICAL > CENTER" > To check if 2 sequences are equal, use equal(s1, s2) instead of s1 = s2. You're using 'if Fields = {} then', but you should be using 'if equal(Fields, {}) then', or even better: 'if length(Fields) = 0 then'. -- Recycle your pets. tommy online: http://users.telenet.be/tommycarlier tommy.blog: http://tommycarlier.blogspot.com