Share this page

# lrs_get_static_buffer

Buffer Functions

Gets a static buffer or part of it.

    char *lrs_get_static_buffer( char *s_desc, char *buffer, int offset, int length, char *encoding );

s_desc | A descriptor identifying the socket.
buffer | A descriptor identifying a static buffer.
offset | The offset inside the buffer (binary representation of the data).
length | The length of the data to retrieve (binary representation of the data).Specify -1 to ignore the offset and retrieve the whole buffer.
encoding | The encoding method for the returned data. The possible values are "ascii" or "ebcdic". A NULL value indicates the original client format.

The lrs_get_static_buffer function retrieves a static buffer or part of the buffer from the data file. You specify the buffer as well as the offset and length of the data to retrieve. This buffer is returned after any parameter substitution.

After this function is executed, the retrieved buffer (or a part of it) is stored in an internal buffer (User Buffer) in the format specified by the encoding parameter. The return value is a pointer to the user buffer. If the encoding parameter is set to NULL, the user buffer is stored in the original client format (either ebcdic or ascii).

To retrieve the contents of the user buffer, use lrs_get_user_buffer. To determine its size, use lrs_get_user_buffer_size.

Note that the following functions overwrite the same internal buffer (user buffer):

- lrs_ascii_to_ebcdic

- lrs_ebcdic_to_ascii

- lrs_get_static_buffer

- lrs_get_static_buffer

- lrs_decimal_to_hex_string

In all of the above user buffer functions (except lrs_decimal_to_hex_string), use lrs_get_user_buffer_size to determine the actual buffer size before printing the buffer contents. Do not retrieve the entire buffer using a -1 as the length argument, and then try to print its contents. The reason for this is that VuGen may misinterpret the NULL characters within the buffer as a terminating string. Print functions include all the Message Functions such as lr_output_message.

This function is not recorded during a WinSock session—you manually insert it into your script.

## Return Values

Windows Sockets Return Values

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

In the following example, lrs_get_static_buffer gets a segment of the static buffer received on "socket2", "\xff\xffHost=phobos\r\n". It retrieves six bytes of data at an offset of 7, which is the Host Name.

Copy code

    char *HostName;
    HostName = lrs_get_static_buffer ("socket2", "buf2", 7, 6, NULL);
    /* The value in HostName is now "phobos" */
    To save the contents of a buffer to a parameter for later use, type:
    lrs_save_param_ex("socket2", "user", HostName, 0, 6, "ascii", "new_parameter");
    lr_output_message("The new parameter = \"%s\"\n", lr_eval_string("< new_parameter >"));

The output generated by the above code, as seen in the VuGen Execution log is:
`Message from run.c(52):The new parameter = "phobos"`

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: