# tibemsMsg_GetAsBytesCopy

Function

## Purpose

Copy a byte sequence representation of the message object into storage supplied by the program.

## C Declaration

    tibems_status tibemsMsg_GetAsBytesCopy(
        const tibemsMsg message,
        const void* bytes,
        tibems_int avail_size,
        tibems_int* actual_size );

## COBOL Call

    CALL "tibemsMsg_GetAsBytesCopy"
         USING BY VALUE message,
               BY REFERENCE bytes,
               BY VALUE avail-size,
               BY REFERENCE actual-size,
               RETURNING tibems-status
    END-CALL.

Note: `message` has usage pointer.

## Parameters

Parameter | Description
--- | ---
`message` | Fill the byte array with the content of this message.
`bytes` | Store the byte sequence in this location. Your program must supply suitable storage for a byte sequence.
`avail_size` | Length of the storage available for the byte sequence.
`actual_size` | Store the length of the byte sequence.

## Remarks

This call formats the data of the message as a byte sequence in EMS wire format, which is suitable for archiving in a file.

Your program must allocate storage for the byte sequence, and supply a pointer to it as an argument.

The byte sequence includes data from the message header, message properties, and all message fields.

The byte sequence might contain interior null bytes.

Status Code | Description
--- | ---
`TIBEMS_INSUFFICIENT_BUFFER` | The buffer is not large enough for the data. The return parameter `actual_size` indicates the size of the required buffer.

## See Also

`tibemsMsg_CreateFromBytes`

`tibemsMsg_GetAsBytes`

`tibemsMsg_GetByteSize`

Copyright © Cloud Software Group, Inc. All rights reserved.