如题,现有1个[XXX.LOG]文件,里面有15行文字,我想读取里面的第5行到第10行的内容,然后以LIST的方式返回..
跪求源代码...急...

解决方案 »

  1.   

    private sub command1_click()
      dim i as integer,s as string
      open "c:\XXX.LOG" for input as #1
      for i=1 to 10
        line input #1,s
        if i>=5 then list1.additem s
      next i
      close #1
    end sub
      

  2.   

    完善点的:private sub command1_click()
      dim i as integer,s as string
      if dir("c:\XXX.LOG")="" then
        msgbox "文件不存在"
        exit sub
      end if
      open "c:\XXX.LOG" for input as #1
      for i=1 to 10
        if eof(1) then
          msgbox "数据不完整"
          close #1
          exit sub
        end if
        line input #1,s
        if i>=5 then list1.additem s
      next i
      close #1
    end sub