DIAdem Help

Method: GetNextStringValue for File

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

Method: GetNextStringValue for File

Reads a value at the current file position and moves the file pointer according to the data type of the value.

The method reads up to the delimiter specified by File.Formatter.Delimiters. If no delimiter is found, the method reads up to the line feed character specified by File.Formatter.LineFeeds.

vGetNextStringValue = Object.GetNextStringValue(DataType)

ObjectFile
Object with this method
DataType Specifies the date type of the value to be read out.
Enumeration with the following selection terms:
2 eI16 16-bit integer values
3 eI32 32-bit integer values
4 eI64 64-bit integer values
5 eByte Byte
6 eU16 16-bit unsigned integer
7 eU32 32-bit unsigned integer
8 eU64 64-bit unsigned integer
9 eR32 32-bit real values
10 eR64 64-bit real values
23 eString Text
24 eEnum Enumeration
30 eTime Time values
vGetNextStringValueVariant
Receives the value that has been read out.
When the method reaches the end of the line, the return value is a VT_EMPTY type variant.
If the method cannot read out any values between two delimiters or after a delimiter, the return value is a VT_NULL type variant.
Note  Because GetNextStringValue does not advance past the end of the line, you must use File.SkipLine to position the file pointer in the next line.

The following example reads text from a file. The texts are delimited by a colon within the line. The texts are names and values of Root properties.

Dim PropName, PropValue
File.Formatter.LineFeeds = vbNewLine
File.Formatter.Delimiters = ":"
While not File.Position = File.Size
  PropName  = File.GetNextStringValue(eString)
  PropValue = File.GetNextStringValue(eString)
  Call Root.Properties.Add(PropName, PropValue)
  Call File.SkipLine()
Wend

Log in to get a better experience