Share this page

# lrs_decimal_to_hex_string

Conversion Functions

Converts an integer into a HEX string.

    char*  lrs_decimal_to_hex_string( char* s_desc, char* buf, long length );

s_desc | A descriptor identifying an unbound socket.
buf | A pointer to the buffer containing the decimal string.
length | The length of the string.

The lrs_decimal_to_hex_string function converts an integer into a hexadecimal string. For example, if a string appears as 4, this function converts it to \x04.

The translated buffer is stored in the internal user buffer. To retrieve the contents of the buffer, use lrs_get_user_buffer. To determine the size of the buffer, 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_received_buffer

- lrs_get_static_buffer

- lrs_decimal_to_hex_string

## Return Values

Windows Sockets Return Values

## Parameterization

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

## Example

In the following example, the lrs_decimal_to_hex_string function converts an integer into a hexadecimal string. The script displays the value of the HEX string if it is not NULL.

    lrs_send("socket0", "buf3", LrsLastArg);

    lrs_receive("socket0", "buf4", LrsLastArg);

    tmp = lrs_get_received_buffer("socket0", 29, 1, NULL);

        /* translate 4 to \x04 */

    tmp2 = lrs_decimal_to_hex_string("socket0",tmp,1);

    if (NULL != tmp2 && lrs_get_user_buffer_size("socket0") == 4 )

    {

        lr_output_message("tmp2=%s",tmp2);

    }

    lrs_send("socket0", "buf5", LrsLastArg);

    lrs_receive("socket0", "buf6", LrsLastArg);

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: