Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Windows ! (n/t)

Author: Matthias Gemuh

Date: 07:06:29 02/08/04

Go up one level in this thread




If your solution (for Borland C++ Builder) is better than mine, post it here.

void ReadStdIn(AnsiString &pStdIn)
{
    char str[5];
    DWORD nBytesRead=0L;
    BOOL bRead;

    bRead = PeekNamedPipe((HANDLE)StdIn, NULL, 0, NULL, &nBytesRead, NULL); if
(nBytesRead==0) return;
    while (1) {
      bRead = ReadFile((HANDLE)StdIn, (LPVOID)(LPSTR)str, (DWORD)1,
(LPDWORD)&nBytesRead, (LPOVERLAPPED)NULL);
      if (!bRead) break; if (str[0] != '\n') { str[1] = '\0'; pStdIn = pStdIn +
str; } else break;
    }
}


/Matthias.



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.