Sends key strokes to the terminal emulator.
HCON Library
C (libg3270.a)
Pascal (libg3270p.a)
FORTRAN (libg3270f.a)
The g32_send_keys function sends one or more key strokes to a terminal emulator as though they came from the keyboard. ASCII characters are sent by coding their ASCII value. Other keys (such as Enter and the cursor-movement keys) are sent by coding their values from the g32_keys.h file (for C programs) or g32keys.inc file (for Pascal programs). FORTRAN users send other keys by passing the name of the key through the G32SENDKEYS buffer.
The g32_send_keys function can only be used in API/3270 mode.
The g32_send_keys function is part of the Host Connection Program (HCON).
The g32_send_keys function requires one or more adapters used to connect to a host.
In a DBCS environment, the g32_send_keys function only sends SBCS keystrokes, including ASCII characters, to a terminal emulator. DBCS characters are ignored.
Item | Description |
---|---|
as | Specifies a pointer to the g32_api structure. Status is returned in this structure. |
buffer | Specifies a pointer to a buffer of key stroke data. |
Item | Description |
---|---|
as | Specifies the g32_api structure. Status is returned in this structure. |
buffer | Specifies a pointer to a string containing the keys to be sent to the host. The string must be at least as long as indicated in the g32_api structure. |
Item | Description |
---|---|
AS | Specifies the g32_api equivalent structure as an array of integers. |
BUFFER | The character array containing the key sequence to send to
the host. A special emulator key can be sent by the g32_send_keys function
as follows:
|
The special emulator strings recognized by the g32_send_keys function are as follows:
CLEAR DELETE DUP ENTER
EOF ERASE FMARK HOME
INSERT NEWLINE RESET SYSREQ
LEFT RIGHT UP DOWN
LLEFT RRIGHT UUP DDOWN
TAB BTAB ATTN
PA1 PA2 PA3
PF1 PF2 PF3 PF4
PF5 PF6 PF7 PF8
PF9 PF10 PF11 PF12
PF13 PF14 PF15 PF16
PF17 PF18 PF19 PF20
PF21 PF22 PF23 PF24
CURSEL
Item | Description |
---|---|
0 | Indicates successful completion. |
-1 | Indicates an error has occurred.
|
The following example fragment illustrates, in C language, the use of the g32_send_keys function in an api_3270 mode program:
#include <g32_api.h> /* API include file */
*include <g32_keys.h>
main()
{
struct g32_api *as; /* g32 structure */
char *buffer; /* pointer to char string */
int return; /* return code */
char *malloc(); /* C memory allocation
function */
.
.
.
return = g32_notify(as,1); /* Turn notification on */
buffer = malloc(10);
return = g32_get_cursor(as); /* get location of cursor */
printf (" The cursor position is row: %d col: %d/n",
as -> row, as -> column);
/* Get data from host starting at the current row and column */
as -> length = 10; /* length of a pattern on host */
return = g32_get_data(as,buffer); /* get data from host */
printf("The data returned is <%s>\n",buffer);
/* Try to search for a particular pattern on host */
as ->row =1; /* row to start search */
as ->column =1; /* column to start search */
return = g32_search(as,"PATTERN");
/*Send a clear key to the host */
return = g32_send_keys(as,CLEAR);
/* Turn notification off */
return = g32_notify(as,0);
.
.
.