字符串VisualBasic中的WSH最大阵列 [英] Maximum Array of Strings VisualBasic WSH

查看:121
本文介绍了字符串VisualBasic中的WSH最大阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写在VB WSH脚本读取庞大的目录列表通过.RUN方法重定向目录列表生成的。

I'm writing a WSH script in VB to read a massive directory listing generated with a redirected directory listing via .Run method.

目录列表约8400线,但每次我运行该脚本,下面的循环

The directory listing is about 8400 lines, but every time I run the script, the following loop

做,直到DirList.AtEndOfStream
   REDIM preserve arrData(I)
   arrData(ⅰ)= DirList.ReadLine
   I = I + 1
循环

Do Until DirList.AtEndOfStream Redim Preserve arrData(i) arrData(i) = DirList.ReadLine i = i + 1 Loop

削减了早,在1800至3500线看似随意的范围。这听起来像一个数组的大小问题或shell内存限制?

cuts out early, in a seemingly random range of 1800 to 3500 lines. Does this sound like an array size issue or a shell memory limit?

我听说有人分析大的日志文件,阅读他们都在一次像我有。

I have heard of people parsing LARGE log files, reading them all in at once like I have.

推荐答案

会不会更好,在这种情况下,到通过文件循环的第一和计数行数,然后REDIM阵列所需的精确尺寸。然后关闭该文件再次打开这个时候你居然行分配给数组元素?

Would it not be better, in this instance, to cycle through the file first and count the number of lines, then Redim the array to the exact size required. Then close the file open it again this time you actually assign the lines to the array elements?

这篇关于字符串VisualBasic中的WSH最大阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆