sefiroth 发表于 2008-12-11 08:46:00

求助高手如何实现循环读取dat文件里面的数据

用(while (setq xRec (read-line fp))<br/>读取之后,需要继续(setq e1 xRec)<br/>(setq e2 xRec)<br/>以此类推,现在大概有100多个e,太费劲儿了,有没有简单的赋值方法??<br/>

caoyin 发表于 2008-12-11 08:50:00

<p>放在表里面啊!!</p><p>(setq lst nil)<br/>(while (setq xRec (read-line fp))<br/>&nbsp;&nbsp;&nbsp; (setq lst (cons xRec lst))<br/>)<br/><br/></p>

nonsmall 发表于 2008-12-11 08:51:00

<p>(setq xRec_list nil)</p><p>(while (setq xRec (read-line fp))</p><p>(setq xRec_list (append xRec_list (list xRec)))</p><p>)</p>xRec_list 是你要的表<br/>

sefiroth 发表于 2008-12-11 09:06:00

我是想把e1到e100多赋值,然后读取其中的数,因为要根据下拉菜单来选择读取e多少,而且在dcl还要实现参数选择菜单,也就是参数要提前显示在dcl中,那要的话,数据必须全部保存在e1到e100多中,要不然就没法实现了,上面的程序只能读取一次啊,还是不能循环读取并保存

caoyin 发表于 2008-12-11 09:13:00

(setq&nbsp;i 0)<br/>(while (set&nbsp;(read (strcat&nbsp;"e" (itoa (setq i (1+ i)))))&nbsp;(read-line fp)))

caoyin 发表于 2008-12-11 09:17:00

<p>这样比较浪费内存,程序结束加上以下代码</p><p>(repeat i</p><p>&nbsp; (set&nbsp;(read (strcat&nbsp;"e" (itoa (setq i (1- i)))))&nbsp;nil)</p><p>)</p>

lajjs 发表于 2008-12-31 15:32:00

都是高手哟!!!
页: [1]
查看完整版本: 求助高手如何实现循环读取dat文件里面的数据