OpenTextFile
来源:互联网 发布:域名不以封疆 编辑:程序博客网 时间:2024/06/06 09:28
Visual Basic for Applications Reference
Visual Studio 6.0
OpenTextFile Method
See Also Example Applies To Specifics
Description
Opens a specified file and returns a TextStream object that can be used to read from or append to the file.
Syntax
object.OpenTextFile(filename[, iomode[, create[, format]]])
The OpenTextFile method has these parts:
PartDescriptionobjectRequired. Always the name of a FileSystemObject.filenameRequired. String expression that identifies the file to open.iomodeOptional. Indicates input/output mode. Can be one of two constants, either ForReading or ForAppending.createOptional. Boolean value that indicates whether a new file can be created if the specified filename doesn't exist. The value is True if a new file is created; False if it isn't created. The default is False.formatOptional. One of three Tristate values used to indicate the format of the opened file. If omitted, the file is opened as ASCII.Settings
The iomode argument can have either of the following settings:
ConstantValueDescriptionForReading1Open a file for reading only. You can't write to this file.ForAppending8Open a file and write to the end of the file.The format argument can have any of the following settings:
ConstantValueDescriptionTristateUseDefault2Opens the file using the system default.TristateTrue1Opens the file as Unicode.TristateFalse 0Opens the file as ASCII.Remarks
The following code illustrates the use of the OpenTextFile method to open a file for appending text:
Sub OpenTextFileTest Const ForReading = 1, ForWriting = 2, ForAppending = 3 Dim fs, f Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.OpenTextFile("c:\testfile.txt", ForAppending,TristateFalse) f.Write "Hello world!" f.CloseEnd Sub
0 0
- OpenTextFile
- OpenTextFile Method
- OpenTextFile 方法
- CreateTextFile&OpenTextFile
- JavaScript中OpenTextFile函数
- fso OpenTextFile 方法
- ActiveXObject对象的OpenTextFile方法介绍
- VBS读写文件以及OpenTextFile方法
- 关于js的CreateTextFile和OpenTextFile
- JavaScript中OpenTextFile函数 - JavaScript手册
- HDU-4772-Zhuge Liang's Password
- Android指令中英文解
- 匿名内部类JAVA
- 数据结构——实验一 VC编程工具的灵活使用
- Best Time to Buy and Sell Stock_Runtime error 1
- OpenTextFile
- iOS Developer:真机测试
- android ContentResolver ContentProvider 详解
- 近期非技术类书籍读书计划
- com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value
- Android中的style和theme的用法
- UINavigationController 导航控制器
- system函数的总结
- 黑马程序员_问题总结(持续更新)