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_lookfor()</b> - look for character in input buffer http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   tp_lookfor() - look for character in input buffer

   nWhere := tp_lookfor(nPort, cChar)

   nPort       Serial port number.
   cChar       Character to look for.

   Returns     Character position in buffer, or 0 if not found.

   Searches the input buffer for a specified character.  If found, it
   returns the position in the input buffer (number of characters to
   read to get all data up to and including the character).  Returns 0
   if the character is not found.

   Example:

       do while .t.
           if tp_lookfor(1, chr(10))   // chr(10) is line feed.
               process(tp_recvto(1, chr(10)))
           endif

           // This would be a good place to do some other processing

           @ 10,10 say time()
           @ 12,10 say "There are "+ltrim(str(tp_inchrs(1)))+ ;
               " characters in the port   "
       enddo

See Also: tp_recvto() tp_onchar()

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