|
Question : how to write to end of a file using scripting.textstream
|
|
hi, i have a "stupid" question. i just cannot figure out how to use write or writeline to add something to the bottom of an existing file instead of overwriting it. could you pls help?
maybe i need to do txtfile.write(array.getstring(...))? where array is on new information, and txtfile is the textstream.
thank u!!
|
Answer : how to write to end of a file using scripting.textstream
|
|
you really need this method
object.OpenTextFile (filename [, iomode[, create[, format]]])
http://www.devguru.com/technologies/vbscript/quickref/filesystemobject_opentextfile.html
from the link above:
The following example will open the file, "c:\somefile.txt" (or create it if it does not exist), and append the specified text to it.
Code: <% dim filesys, filetxt Const ForReading = 1, ForWriting = 2, ForAppending = 8 Set filesys = CreateObject("Scripting.FileSystemObject") Set filetxt = filesys.OpenTextFile("c:\somefile.txt", ForAppending, True) filetxt.WriteLine("Your text goes here.") filetxt.Close %>
|
|
|
|