# Re: 读档 ??

Posted by AndyLin on September 18, 1998 at 16:07:55:

In Reply to: 读档 ?? posted by tang on September 18, 1998 at 11:56:55:

: For n = 1 To x
: Open "d:\vb_test\" & c(n) For Input As #1
: j = 0
: Do While Not EOF(1)
: Line Input #1, readline
: j = j + 1
: Loop
: Close #1
:
: ReDim xArray(j)
: ReDim b(j)
:
: Open "d:\vb_test\" & c(n) For Input As #1
: Close #1
: Next n
: For m = 1 To j
: Line Input #1, b(m) <--- ** debug here **
: Next m

: 请问在上述一段程式中利用 For 回圈读档计算各档案的行数
: 再将每一行暂存到 b(m) 中
: 可是当跑到开第二个档案就会产生 error
: WHY ???
: Thanks !

若你在程式宣告中没有设定 option base 1 ,则阵列起始是从 0 开始,所以你的程式应该改成
: For m = 0 To j-1
: Line Input #1, b(m)
: Next m
或者在宣告中加入 option base 1

Follow Ups:

- Re: 读档 ?? tang 09:21:39 9/19/98 (2)
  - Re: 读档 ?? AndyLin 09:36:59 9/19/98 (1)
    - Re: 读档 ?? tang 11:12:56 9/19/98 (0)