Programming with Reflection

image\rwnprg32.gif ReadUntil method


Syntax Chars = object.ReadUntil(UntilChars, [Timeout], [Options], [WhichTerminator])



Reads characters from the host until one of the specified terminator characters is received. The terminator character is not included in the returned string.

If this method times out before one of the terminator characters is received, no error is generated. The return value contains any characters received before the timeout occurred. The WhichTerminator argument can be used to determine if a timeout occurred (if WhichTerminator is an empty string, a timeout occurred).

If you're using the ReadUntil method to read incoming datacomm from an external application (such as stand-alone Visual Basic), you should set the ProcessDatacomm property to False to prevent Reflection from reading and processing characters between calls to Reflection methods.


UntilChars Argument Type: String
Specifies one or more characters, any one of which can terminate the read operation. Use the Chr$ function to specify binary values (such as CR and DC1). For example:
Terminators = Chr$(rcCR) + Chr$(rcDC1)

 Click here for a list of character code constants for nonprinting characters (such as rcCr).

Timeout Argument Type: String
Specifies the amount of time to wait for the specified terminator characters to be received. The string is specified in HH:MM:SS.hh format. If this argument is omitted or is empty (""), Reflection waits indefinitely if none of the terminators is received.

Options Argument Type: Enumeration
Specifies additional, non-default behavior for the method. There are two options for this method:


 Indicates that the string should not be translated from the host character set into the PC character set.


 Specifies that incoming characters should not be displayed in the terminal window.

 To combine the two options, use the addition operator: rcNoTranslation + rcNoDisplay.

WhichTerminator Argument Type: String
Receives the terminator (a single character) that ended the read. If a timeout occurs, an empty string is returned in this variable.


Chars Return type: String
The characters read from the host (not including the read terminator character).



rcErrInvalidTerminator The UntilChars list was empty ("").


image\jump.gif Keyword Index

image\popup.gif Related Topics

image\popup.gif Reflection products that use this command