源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

VBS教程:方法-ReadAll 方法

  • 时间:2022-01-17 15:50 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:VBS教程:方法-ReadAll 方法

ReadAll 方法

读入全部 [b]TextStream[/b] 文件并返回结果字符串。 [code][i]object.[/i][b]ReadAll[/b][/code] object 应为 TextStream 对象的名称。 [h3]说明[/h3]对于大文件,使用 [b]ReadAll[/b] 方法浪费内存资源。应该使用其他技术输入文件,例如按行读文件。
[code]Function ReadAllTextFile  Const ForReading = 1, ForWriting = 2  Dim fso, f  Set fso = CreateObject("Scripting.FileSystemObject")  Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)  f.Write "[/code]世界你好[code]!"[/code][code]  Set f = fso.OpenTextFile("c:\testfile.txt", ForReading)[/code][code]  ReadAllTextFile =  [b]f.ReadAll[/b][/code][code]End Function[/code]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部