- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- ' CreateLyrics
- ' 目的:
- ' 在文件夹中创建两个文本文件。
- ' 示范下面的内容
- ' - FileSystemObject.CreateTextFile
- ' - TextStream.WriteLine
- ' - TextStream.Write
- ' - TextStream.WriteBlankLines
- ' - TextStream.Close
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Sub CreateLyrics(Folder)
- Dim TextStream
- Set TextStream = Folder.CreateTextFile("OctopusGarden.txt")
- TextStream.Write("Octopus' Garden ") ' 请注意,该语句不添加换行到文件中。
- TextStream.WriteLine("(by Ringo Starr)")
- TextStream.WriteBlankLines(1)
- TextStream.WriteLine("I'd like to be under the sea in an octopus' garden in the shade,")
- TextStream.WriteLine("He'd let us in, knows where we've been -- in his octopus' garden in the shade.")
- TextStream.WriteBlankLines(2)
- TextStream.Close
- Set TextStream = Folder.CreateTextFile("BathroomWindow.txt")
- TextStream.WriteLine("She Came In Through The Bathroom Window (by Lennon/McCartney)")
- TextStream.WriteLine("")
- TextStream.WriteLine("She came in through the bathroom window protected by a silver spoon")
- TextStream.WriteLine("But now she sucks her thumb and wanders by the banks of her own lagoon")
- TextStream.WriteBlankLines(2)
- TextStream.Close
- End Sub
- ' GetLyrics
- ' 目的:
- ' 显示 lyrics 文件的内容。
- ' 示范下面的内容
- ' - FileSystemObject.OpenTextFile
- ' - FileSystemObject.GetFile
- ' - TextStream.ReadAll
- ' - TextStream.Close
- ' - File.OpenAsTextStream
- ' - TextStream.AtEndOfStream
- ' - TextStream.ReadLine
- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Function GetLyrics(FSO)
- Dim TextStream
- Dim S
- Dim File
- ' 有多种方法可用来打开一个文本文件,和多种方法来从文件读取数据。
- ' 这儿用了两种方法来打开文件和读取文件:
- Set TextStream = FSO.OpenTextFile(TestFilePath & "\Beatles\OctopusGarden.txt", OpenFileForReading)
- S = TextStream.ReadAll & NewLine & NewLine
- TextStream.Close
- Set File = FSO.GetFile(TestFilePath & "\Beatles\BathroomWindow.txt")
- Set TextStream = File.OpenAsTextStream(OpenFileForReading)
- Do While Not TextStream.AtEndOfStream
- S = S & TextStream.ReadLine & NewLine
- Loop
- TextStream.Close
- GetLyrics = S
- End Function
filesystemobject组件的用法示例
2019-10-31 13:37asp教程网 ASP教程
filesystemobject组件的用法示例
延伸 · 阅读
- 2024-12-13安全软件组件反成黑客帮凶:研究公司曝光攻击
- 2022-03-08React 非父子组件传参的实例代码
- 2022-03-07易语言给组件上加载图片方法步骤
- 2022-03-06易语言农历月历组件使用方法
- 2022-03-06详解易语言透明标签组件
- 2022-03-03易语言寻找组件的使用技巧
精彩推荐
- ASP教程
JScript中遍历Request表单参数集合的方法
这篇文章主要介绍了JScript中遍历Request表单参数集合的方法,本文以遍历Request.QueryString集合为例给出了实现代码,需要的朋友可以参考下...
- ASP教程
ASP.NET 数据源
数据源 一个 data sourse 控件与数据绑定的控件相互作用,并隐藏了复杂的数据的联编过程。这些是提供数据给 data bound 控件的工具,并且支持如插入,删除...
- ASP教程
asp之基于adodb.stream的文件操作类
asp之基于adodb.stream的文件操作类...
- ASP教程
asp+javascript实现404页的处理转换
asp+javascript实现404页的处理转换...
- ASP教程
ASP常用函数:getpy()
ASP常用函数:getpy()...
- ASP教程
asp 采集实战代码
最近实在是太流行采集了,本人是不喜欢采集的,但对采集的原理我却很有兴趣进行研究,拿到了网上采集常用函数,对其进行了一番研究,并实战,结果...
- ASP教程
asp Access数据备份,还原,压缩类代码
asp Access数据备份,还原,压缩类实现代码,大家可以参考下。...
- ASP教程
asp 标记字符串中指定字符变色不区分大小写
今天遇到这种问题,单纯的使用replace函数不行,他会改变原有的字符串的大小写,在网上找到相关的代码,自己备份下...