Share this page

# lrs_get_user_buffer

Buffer Functions

Retrieves the contents of the user data buffer.

    char *lrs_get_user_buffer( char *s_desc );

s_desc | A descriptor identifying the socket.

The lrs_get_user_buffer function retrieves the contents of the user data buffer for the specified socket.

For more information on the functions that overwrite the user buffer, see one of the following functions:

- lrs_ascii_to_ebcdic

- lrs_ebcdic_to_ascii

- lrs_get_received_buffer

- lrs_get_static_buffer

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.

## Return Values

If this function fails, it returns NULL. If it succeeds, it returns a pointer to the converted buffer.

## Parameterization

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

## Example

In the following example, lrs_get_user_buffer retrieves the contents of the user buffer, "buf10", received on "socket1", containing "\x17\x01X-AUTHENTICATION-1".

    char *UserBuf, *StrToLog;

    int LenOfUserBuf;

    lrs_get_static_buffer("socket1", "buf10", 0, -1, NULL);

    UserBuf = lrs_get_user_buffer("socket1");

    LenOfUserBuf = lrs_get_user_buffer_size("socket1");

    StrToLog = (char*)malloc(LenOfUserBuf + 1);

    /* copy user buffer and skip two unprintable characters at the beginning */

    strncpy(StrToLog, UserBuf+2, LenOfUserBuf-2);

    lr_output_message("UserBuf = \"%s\"", StrToLog);

The output generated by the above code, as seen in the VuGen Execution log is:
Message from run.c(52): UserBuf = "X-AUTHENTICATION-1"

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