Share this page

# lrs_ebcdic_to_ascii

Conversion Functions

Converts buffer data from EBCDIC format to ASCII format.

    char *lrs_ebcdic_to_ascii( char *s_desc, char *buff, long length );

s_desc | A descriptor identifying a socket.
buff | A pointer to the buffer.
length | The buffer length.

The lrs_ebcdic_to_ascii function converts binary buffer data from EBCDIC format to ASCII format. The translated buffer is stored in the internal buffer (User Buffer ), in ASCII format. 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

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. 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 lrs_ebcdic_to_ascii converts the contents of socket0 from ebcdic to ascii.

Copy code

    char *UserBufferPtr;
    /* Get the whole last received buffer (the offset parameter is ignored) in EBCDIC format */
        UserBufferPtr = lrs_get_received_buffer("socket0", 0, -1, "ebcdic");
    /* Convert the buffer to ASCII format */
        UserBufferPtr = lrs_ebcdic_to_ascii("socket0", UserBufferPtr,
        lrs_get_user_buffer_size("socket0"));

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: