Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Telepathy Communications Library - <b>tp_recvto()</b> - receive string up to delimiter http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   tp_recvto() - receive string up to delimiter

   cString := tp_recvto(nPort, cDelim, [nMaxLen], [nTimeout])

   nPort       Serial port number.
   cDelim      Delimiter character(s).
   nMaxLen     Maximum input length.
   nTimeout    Maximum wait time, in seconds.

   Reads characters from the serial port until reaching the delimiting
   character cDelim.  Returns a string of all charactes up to and
   including the delimiter.

   If nTimeout is specified, waits up to nTimeout seconds to receive the
   delimiter.  If nTimeout is omitted or zero, reads until finding the
   delimiter or the input buffer is empty.  -1 for nTimeout waits
   forever (until the delimiter is received, the maximum input length is
   reached, tp_idle() returns TRUE, or an input error occurs).

   In any case, no more than nMaxLen characters will be read.  The
   default value of nMaxLen is 64999, the maximum length possible for a
   Clipper string.

   If cDelim is a string of more than one character, tp_recvto() will
   return when it finds any one of the characters in cDelim.  (Think of
   cDelim as a set of characters, rather than a string.)

   To determine how input was terminated, check the value of tp_error()
   immediately after calling tp_recvto().  If the terminator was found,
   tp_error() will return 0 (and the last character of the returned
   string will be the terminator).  If tp_recvto() reached the input
   length limit without finding the terminator, tp_error() will return
   -8 (TE_LENGTH).  Any other failure will be reported by tp_error()
   with the appropriate code.

   Example:

       cLine := tp_recvto(1, chr(10), NIL, 10)

See Also: tp_recv() tp_recvln() Error Codes

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson