中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-02 00:32
48,037 topics / 350,122 posts / today 2 new / 48,250 members
DOS批处理 & 脚本技术(批处理室) » How to read the content of a text file into a two-dimensional array using VBS&JS
Printable Version  1,879 / 3
Floor1 piziliu2004 Posted 2006-08-24 15:58
中级用户 Posts 139 Credits 321
As the title says.!
C language can conveniently read a 2D array, but how to implement it with VBS and JS?

It seems that VBS all have functions to read a line, readline, read. Does it have a function to directly specify the character in the nth line and nth column of the file?
For JS, similar to C, does it have such a ready-made function?
Floor2 piziliu2004 Posted 2006-08-26 08:59
中级用户 Posts 139 Credits 321
Floor3 3742668 Posted 2006-08-27 19:52
荣誉版主 Posts 718 Credits 2,013
In VBS, you can easily achieve reading specified content of a file by using the skipline method, readline method of the Scripting.FileSystemObject object and the Mid function:


For reading file content into a two-dimensional array, you can use ADO to implement.
Floor4 piziliu2004 Posted 2006-08-28 10:25
中级用户 Posts 139 Credits 321
Thanks.. But the above code doesn't do the judgment of the end of the file. Currently, the key problem I encounter is that VBS judges the end-of-line character of a file. In this way, I can judge how many lines an unknown file has. There is a AtEndOfLine for judging a line end in VBS, but I can't find the function for judging the end of the file. Please help... Thanks in advance.!!!!!!!!!!!
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023