# tibemsBytesMsg_ReadBytes

Function

## Purpose

Read bytes to a byte sequence from the byte stream in the message body.

## C Declaration

    tibems_status tibemsBytesMsg_ReadBytes(
        tibemsBytesMsg message,
        const void** value,
        tibems_int   requested_length,
        tibems_int*  return_length );

## COBOL Call

    CALL "tibemsBytesMsg_ReadBytes"
     USING BY VALUE message,
           BY REFERENCE value,
           BY VALUE requested-length,
           BY REFERENCE return-length,
           RETURNING tibems-status
    END-CALL.

Note: `message` and `value` have usage pointer.

## Parameters

Parameter | Description
--- | ---
`message` | Read bytes from the body of this message.
`value` | The program supplies a location. In that location, this call stores a pointer to the next block of bytes within the bytes message. Your program must not change the bytes, which belong to the message; if you must modify the bytes, make a private copy first.
`requested_length` | Read (at most) this number of bytes from the stream. This argument must be greater than zero.
`return_length` | Store the actual number of bytes that it read. (If the number of bytes remaining in the message is less than the `requested_length`, then this location indicates that number of remaining bytes. Your program must not use bytes beyond this limit.) When the function cannot read even one byte, it stores -1 in this location (and returns a successful status code).

## Remarks

Each call reads bytes from the stream into the byte array, and advances the read position.

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