Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: polling stdin

Author: Thomas McBurney

Date: 08:04:27 07/28/03

Go up one level in this thread


And here's my code :)

SUB GetCommand

    DIM sBuff       AS STRING
    DIM lBytesRead  AS LONG, lTotalBytes AS LONG, lAvailBytes AS LONG
    DIM ReturnCode  AS LONG

    sBuff = CHR$(0)
    ReturnCode = PeekNamedPipe(infile, BYVAL STRPTR(sBuff), 1, lBytesRead,
lTotalBytes, lAvailBytes)


    incommand=""

    'IF ReturnCode=0 THEN EXIT SUB
    IF lTotalBytes=0 THEN EXIT SUB

    DO
        ReturnCode = ReadFile(infile, BYVAL STRPTR(sBuff), 1, lBytesRead, BYVAL
0&)

        IF ASC(sBuff)=10 THEN
   EXIT DO  ' return on line feed
        END IF

        incommand=incommand+sBuff

    LOOP

END SUB



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.