## int v24Read

## ( v24_port_t* port, unsigned char* Buffer,
size_t Len )

## Documentation

> `v24Read` is the basic function to get one or more received data bytes out of the receive queue. If the queue is empty, the behavious of the function depends on the used open flags. Without any open flags, a empty receive queue leads to an error. If the flag `V24_NON_BLOCK` is used, the function will wait for the reception of character. The wait time is limited to the given timeout time. If this limit is exceeded, the function aborts waiting. If nothing is read, the returned value is `0`, and the error code is set to `V24_E_TIMEOUT`. At this level it's no real error, so there is no error report for the debug output (see `V24_DEBUG_ON` in v24OpenPort).

> The parameter `Buffer` references a buffer that should hold the received characters. The parameter `Len` is the number of characters to read.

> The function returns the number of character read. An error is indicated by a return vlaue of `-1`. Use v24QueryErrno to get the exact error code.

> Possible error code are `V24_OK`, `V24_E_NULL_POINTER`, `V24_E_ILLHANDLE`, `V24_E_TIMEOUT` or `V24_READ`.

> Note: the caller has to ensure, that `Buffer` can hold the `Len` characters.

Parameters:
  port - pointer to handle of the opened port.
  Buffer - pointer to buffer to hold the data.
  Len - number of characters to receive.
Returns:
  (int) number of received characters or `-1`.
See Also:
  v24QueryErrno, v24Getc, v24Gets.

Alphabetic index

This page was generated with the help of DOC++.