COMM-DRV/Lib: GetByte() Gets a byte from the receive buffer

Description-

Gets a byte from the receive buffer. This function will wait for up to the amount of time set by SetTimeout() before returning failure if a byte is not present.

Syntax-

byte = GetByte(port);

On Entry-

int port;

Port previously opened with InitializePort() or OpenComPort().

On Exit-

int byte;

The returned byte.
else
-1 If port not initialized or no byte to be read.

See Also-

GetPacket()
GetString()

Example-

#include <comm.h>
int  data;
int  i;
int  port=0;
char buf[256];

for (i=o;i<sizeof(buf);i++)
    {
    if ((data=GetByte(port)) == -1)
        {
        printf("No more bytes available\n");

        /* End of serial data collection */
        break;
        }
     else
        buf[i] = (char)data;
}