int v24Gets

( v24_port_t* port, char* Buffer, size_t BuffSize )

Receive a string.

Documentation

Receive a string. Unlike v24Read, which tries to read a fixed number of character, v24Gets read characters unless BuffSize characters are fetched, or a end of line (\n) is recieved. At the end of the game, the number of characters read ist returned. If an error occurs, a -1 is returned. The characters are stored in Buffer. The functions ensures a \0 terminated string!

Possible error code are V24_OK, V24_E_NULL_POINTER, V24_E_ILLPARM, V24_E_ILLHANDLE or V24_WRITE. To get this error code, use v24QueryErrno.

A string should at least have 1 character and the terminating \0. The parameter BuffSize must therefore be greater than 1! If not, the operation results in a V24_E_ILLPARM error. To read a single character, we have v24Getc.

Implementation note: the current release of the library defines the end of a string as a hard coded constant! Search the internal headers EZV24_END_OF_STRING.

Parameters:
port - pointer to handle of the opened port.
Buffer - pointer to buffer.
BuffSize - the maximum size of the buffer.
Returns:
(int) number of fetched characters or -1.
See Also:
v24QueryErrno, v24Getc, v24Read.

Alphabetic index



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