On 7/5/2004 10:35:47 AM, jeremy jacobs wrote:
>Can vedit:
>1. read a delimited file (tabbed or csv) file line by line
You can handle file line by line with something like
Repeat(ALL) {
// do something for the line
Line(1,ERRBREAK)
}
>2. from each line assign each field to a text register (i.e
>start at reg 10 and incrementally assign each
>field in the delimited file.
The following code reads one line of comma separated fields
into text registers 10, 11, 12, etc.
#10 = 10
while (!AT_eol) {
#11 = Cur_Pos
Search_Block(",",Cur_Pos,EOL_Pos,ERRBREAK+ADVANCE)
Reg_Copy_Block(#10,#11,Cur_Pos-1)
#10++
}
Reg_Copy_Block(#10,Cur_Pos,Eol_Pos)
You should then handle the data in text registers before
reading the next line. (You can not read the whole file into
text registers, since there are only 128 text registers.)
Different approach for handling csv:s can be found in
my HTML table conversion macro HTML_tbl.vdm (in the
HTML Tools package). It converts comma separated (or
Tab separated or whatever) table into HTML table. See:
http://koti.mbnet.fi/pkl/vedit/html.htm#table
--
Pauli