OpenTextFile Method |
Description
Opens a specified file and returns a TextStream object that can be used to read from, write to, or append to the file.
PowerBASIC Syntax
Arguments
Return Value
IDispatch. Reference to a ITextStream interface.
Settings
The IOMode argument can have any of the following settings:
Example [PowerBASIC]
#INCLUDE "windows.inc" #INCLUDE "scrrun.inc"
DIM fso AS IFileSystem DIM pStm AS ITextStream DIM OutString AS STRING
' Create an instance of the FileSystemObject fso = NEWCOM "Scripting.FileSystemObject" ' Open the file for reading pStm = fso.OpenTextFile(UCODE$("C:\MyFolder\Test.txt"), %IOMode_ForReading, %FALSE, %FALSE) ' Read the entire stream into a string OutString = pStm.ReadAll ' Close the file pstm.Close
|