Share this page

# lrs_hex_string_to_int

Conversion Functions

Converts a hex string to an integer.

    int lrs_hex_string_to_int( char* buff, long length, int* mpiOutput );

Input |
buff | A pointer to the string you want to convert.
length | The length of the data.
Output |
mpiOutput | A pointer to the resulting integer.

The lrs_hex_string_to_int converts a hexadecimal string to an integer. You specify a pointer to a buffer containing the string you want to convert, and the length of the string to convert. This function translates the string and assigns the value to the integer reference.

## Return Values

If this function fails, it returns NULL. If it succeeds, it returns a pointer to the converted buffer. You can also retrieve the converted buffer using lrs_get_user_buffer.

## Parameterization

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

## Example

In the following example, the script compares the displayed value with value in the buffer. The lrs_hex_string_to_int converts a hexadecimal string to an integer.

Copy code

    Action()
    {
        char* tmp;
        char* tmp2;
        int i = 0;
        lrs_create_socket("socket0", "TCP", "LocalHost=0", "RemoteHost=server2.abc.co.il:23", LrsLastArg);
        lrs_receive("socket0", "buf0", LrsLastArg);
        tmp = lrs_get_received_buffer("socket0", 5, 2, NULL);
        if ( ! lrs_hex_string_to_int(tmp,2,&i))
         {
           lr_output_message("i=%d",i);
           /* compare i with the same selection in the data.ws and displayed value (F7) */
         }

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: