TE_send_text
| Send Text Functions |
Sends a null-terminated string to a VT terminal emulator.
int TE_send_text( const char * text );
Inputs
| text | A null terminated text. |
TE_send_text sends text to a terminal emulator in VT emulation mode. Nonprintable characters are specified by hexadecimal codes.
Specify nonprintable characters with escaped hexadecimal codes. For example, pass <Escape> as \x1b. To insert a literal backslash, escape it with another backslash: '\\'.
If the text contains brackets that delimit a parameter (by default, '{' and }'), the runtime environment checks if the text between the brackets is the name of an existing parameter. If so, the {param_name} sting is replaced by the value of the parameter. If no such parameter exists, the text, including the brackets, is sent exactly as entered.
Return Values
This function returns 0 if it succeeds, and a negative error code if it fails. It also sets the global variable TE_errno.
Parameterization
You cannot use standard parameterization for any arguments in this function.
Example
This example shows the use of TE_send_text to send help and log off commands that contain control codes:
/* *** The terminal type is VT 100. */
TE_connect(
"comm-type = telnet;"
"host-name = myHost;"
"terminal-id = ;"
"set-window-size = true;"
"security-type = unsecured;"
"terminal-type = vt100;"
"terminal-model = vt100;"
"login-command-file = ;"
"terminal-setup-file = ;"
, 60000);
if (TE_errno != TE_SUCCESS)
return -1;
TE_wait_cursor(24, 2, 100, 90);
/* duration = 688, replay duration = 400, difference = 288 */
lr_think_time(3);
TE_type("MyHost<kReturn>");/* duration = 2579, replay duration = 800, difference = 1779 */
lr_think_time(18);
TE_type("MyPassword<kReturn>");/* duration = -62, replay duration = 200, difference = -262 */
lr_think_time(2);
/* following escape sequence is mapped to "help" command */
TE_send_text("\x1bOP");/* duration = -16, replay duration = 200, difference = -216 */
lr_think_time(3);
/* following escape sequence is mapped to "logout" command */
TE_send_text("\x1bOR");

