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_recvln()</b> - line input with editing http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   tp_recvln() - line input with editing

   cString := tp_recvln(nPort, [nMaxLen], [nTimeout])

   nPort       Serial port number.
   nMaxLen     Maximum line length.
   nTimeout    Maximum wait time, in seconds.

   Reads a line of input from the serial port, allowing interactive
   editing of the input.  The action of tp_recvln() can be controlled by
   the tp_setln() function.  By default, it:

       Echos characters on input.
       Echos control characters as "^" followed by a letter (e.g., "^X"
           for <Ctrl-X>).
       Erases the last character input when <Backsp> is typed.
       Erases the last word of input when <Ctrl-W> is typed.
       Erases the entire input line and starts over when <Esc> is typed.
       Cancels input when <Ctrl-C> is typed.
       Displays tabs every eight spaces.

   nMaxLen is the maximum length of the line, default value 256.

   nTimeout is the number of seconds tp_recvln() will wait for the line.
   The default nTimeout is -1, "wait forever" (until input is finished
   or canceled, or tp_idle() returns TRUE, or an input error occurs).

   The returned string does not include the <CR> which completed the
   line.  If the line was cancelled by Ctrl-C, the returned string
   contains all characters typed up to, but not including, the Ctrl-C.

   To determine how input was terminated, check the value of tp_error()
   immediately after calling tp_recvln().  If it terminated normally,
   tp_error() will return 0.  If terminated by Ctrl-C, tp_error() will
   return -9 (TE_CANCEL).  Any other failure or timeout will be reported
   by tp_error() with the appropriate code.

   Note: This function is designed to acquire input from humans.  If you
   are acquiring input from machines you should use tp_recvto() instead.

   Example:

       tp_send(1, "Enter your name: ")
       cName := tp_recvln(1)

See Also: tp_setln() tp_recvto() Error Codes

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