1.2.4.4.10 SYS_CONSOLE_ReadCountGet Function

C

ssize_t SYS_CONSOLE_ReadCountGet(const SYS_CONSOLE_HANDLE handle)

Summary

Returns number of unread bytes available in the receive buffer.

Description

This function indicates the number of unread bytes in the receive buffer.

Preconditions

The SYS_CONSOLE_Initialize function should have been called before calling this function.

Parameters

ParamDescription
handleHandle to the console instance

Returns

The return value indicates the number of bytes of unread data available in the receive buffer. Returns -1 in case of any error.

Example

ssize_t nUnreadBytes;
ssize_t nBytesRead;
char myBuffer[100];
SYS_CONSOLE_HANDLE myConsoleHandle;

// Get the number of bytes available in the receive buffer.
nUnreadBytes = SYS_CONSOLE_ReadCountGet(myConsoleHandle);

if (nUnreadBytes == -1)
{
    // Handle error
}
// Read the available data into the application buffer.
SYS_CONSOLE_Read( myConsoleHandle, 0, myBuffer, nUnreadBytes );

Remarks

None.