recvrs

Navigation:  Programming language SQC > Built-in functions > Serial >

recvrs

Previous pageReturn to chapter overviewNext page

The recvrs() function checks the received bytes of the serial port associated with the handle.

It returns the amount of received bytes in case of success, otherwise 0.

 

int recvrs(int fd)

 

Example:

 

void main() 

{

    char buffer[100];

    int len,

        fd = openrs(RS232_1,9600,8,0,1,'>');

 

    while(1) 

    {

        if(recvrs(fd))

        {

            len = readrs(fd,buffer,100,1000,'>');

            if(len)

            {

                buffer[len] = '\0';

                printf("buffer %s\n",buffer);

            }

        }

 

        sleep(1000);

     }

     

     return;

}