Author Topic: ITextStream.Close Method  (Read 2343 times)

0 Members and 1 Guest are viewing this topic.

Online José Roca

  • Administrator
  • Hero Member
  • *****
  • Posts: 2524
  • User-Rate: +209/-0
  • Gender: Male
ITextStream.Close Method
« on: July 13, 2008, 11:48:57 PM »

The following example illustrates the use of the Close method.

JScript

Code: [Select]
var fso;
fso = new ActiveXObject("Scripting.FileSystemObject");
a = fso.CreateTextFile("c:\\testfile.txt", true);
a.WriteLine("This is a test.");
a.Close();

VBScript

Code: [Select]
Sub CreateAFile
   Dim fso, MyFile
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set MyFile = fso.CreateTextFile("c:\testfile.txt", True)
   MyFile.WriteLine("This is a test.")
   MyFile.Close
End Sub

PowerBASIC

Code: [Select]
SUB CreateAFile

   LOCAL fso AS IFileSystem
   LOCAL MyFile AS ITextStream

   fso = NEWCOM ("Scripting.FileSystemObject")
   MyFile = fso.CreateTextFile(UCODE$("c:\testfile.txt"), %VARIANT_TRUE)
   MyFile.WriteLine(UCODE$("This is a test."))
   MyFile.Close

END SUB