home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch20 / tstream / tstream.frx < prev    next >
Encoding:
Text File  |  1996-05-11  |  1.1 KB  |  8 lines

  1.  lCreateTextFile Method
  2. This method creates a new text file and returns a TextStream object that can be used to read from or write to the file. The syntax of the CreateTextFile method is:
  3. Set TStream = FSys.CreateTextFile(filename, overwrite, unicode)
  4. The filename argument specifies the name of the file to be created and is the only required argument. Overwrite is a Boolean value that indicates whether you can overwrite an existing file (if True) or not (if False).  If the overwrite argument is omitted, existing files are not overwritten. The last argument, unicode, indicates whether the file is created as a Unicode or ASCII file. If the unicode argument is True, the new file will be created as a Unicode file, otherwise it will be created as an ASCII file. If the unicode argument is omitted, an ASCII file is assumed.
  5. To create a new text file, create a FileSystemObject object variable and then call its CreateTextFile method as follows: 
  6. Set TStream = FSys.CreateTextFile("c:\testfile.txt")
  7. The TStream variable represents a TextStream object, whose methods allow you to write to, or read from, the specified file
  8.