DIAdem Help

Method: Read for TextStream

  • Updated2024-09-12
  • 1 minute(s) read

Method: Read for TextStream

Reads one or more characters from a TextStream file.

sRead = Object.Read(Characters)
ObjectTextStream
Object with this method
CharactersLongInteger
Specifies the number of characters to read.
sReadString
Receives the read text.

The following example opens a text file into which it writes a text line. Then the example opens the file for reading and reads the first four characters:

Function ReadCharacters(sFile)
  Const ForReading = 1, ForWriting = 2
  Dim fso, oMyFile
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set oMyFile= fso.OpenTextFile(sFile, ForWriting, True)
  oMyFile.Write "This is a text"
  Set oMyFile = fso.OpenTextFile(sFile, ForReading)
  ReadCharacters = oMyFile.Read(4)
End Function

Log in to get a better experience