Write Method (FileSystemObject)
Writes a specified string to a TextStream file.
object.Write(string)
Specified strings are written to the file with no intervening spaces or characters between each string. Use the WriteLine method to write a newline character or a string that ends with a newline character.
The following example illustrates the use of the Write method:
function WriteDemo() { var fso, f, r var ForReading = 1, ForWriting = 2; fso = new ActiveXObject("Scripting.FileSystemObject") f = fso.OpenTextFile("c:\\testfile.txt", ForWriting, true) f.Write("Hello world!"); f.Close(); f = fso.OpenTextFile("c:\\testfile.txt", ForReading); r = f.ReadLine(); return(r); }
Function WriteToFile
Const ForReading = 1, ForWriting = 2
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
f.Write "Hello world!"
Set f = fso.OpenTextFile("c:\testfile.txt", ForReading)
WriteToFile = f.ReadLine
End Function
Applies To:
arguments?
Why does this documentation not list all arguments for this method?
The sample code includes arguments that are not documented.
The older MSDN docs included them but why the glaring omissions here? I say omissions (with an "s") as this seems to be a common theme with the new "prettied up" documentation here on MSDN. Clearly all of this was previously written (content that includes the full syntax and argument descriptions must exist somewhere) and the changes to FSO (if any, which is not the case here) would only be incremental. What is written here appears to have been redone from scratch by someone with not enough time to finish it.
The sample code includes arguments that are not documented.
The older MSDN docs included them but why the glaring omissions here? I say omissions (with an "s") as this seems to be a common theme with the new "prettied up" documentation here on MSDN. Clearly all of this was previously written (content that includes the full syntax and argument descriptions must exist somewhere) and the changes to FSO (if any, which is not the case here) would only be incremental. What is written here appears to have been redone from scratch by someone with not enough time to finish it.
- 8/31/2010
- Derek Read