页面导航: 首页脚本专栏vbs → 正文内容

VBS教程:方法-Read 方法

发布:dxy 发布日期:2006-11-16 字体:[增加 减小] 类型:转载

Read 方法

TextStream 文件中读入指定数目的字符并返回结果字符串。

object.Read(characters)

参数

object

必选项。应为 TextStream 对象的名称。

characters

必选项。要从文件读的字符数目。

说明

下面例子举例说明如何使用 Read 方法从文件中读取五个字符并返回字符串结果:

Function ReadTextFileTest  Const ForReading = 1, ForWriting = 2, ForAppending = 8  Dim fso, f, Msg  Set fso = CreateObject("Scripting.FileSystemObject")     Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)  f.Write "世界你好!"  Set f = fso.OpenTextFile("c:\testfile.txt", ForReading)  ReadTextFileTest =  f.Read(5)End Function
百度中搜索更多的关于VBS教程:方法-Read 方法内容,或者用Google搜索相关更多
浏览次数:载入中... 打印本文关闭本文文章来源

文章评论

共有 位脚本之家网友发表了评论我来说两句

同 类 文 章
最 近 更 新
热 点 排 行