Metodo ASP OpenAsTextStream
❮ Riferimento completo all'oggetto file
Il metodo OpenAsTextStream apre il file specificato e restituisce un oggetto TextStream per accedere al file.
Sintassi
FileObject.OpenAsTextStream(mode,format)
Parameter | Description |
---|---|
mode | Optional. How to open the file.
|
format | Optional. The format of the file.
|
Esempio
<%
dim fs,f,ts
set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.GetFile("c:\test.txt")
Set ts=f.OpenAsTextStream(ForWriting)
ts.Write("Hello World!")
ts.Close
Set ts=f.OpenAsTextStream(ForReading)
Response.Write(ts.ReadAll)
ts.Close
set ts=nothing
set f=nothing
set fs=nothing
%>
Output:
Hello World!
❮ Riferimento completo all'oggetto file