Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: C and Linux

Author: Dieter Buerssner

Date: 15:30:07 04/08/02

Go up one level in this thread


On April 08, 2002 at 18:20:04, Dieter Buerssner wrote:

>BTW. For me under Linux it works well to mix buffered Standard C input functions
>working on FILE * with the select call, working on file handles.

Today, is not my day. The above is a misleading. It probably only works after
changing the buffering mode to unbuffered (and because the Xboard protocol is
line bufferer, also linebuffered mode works).

void sys_init(void)
{
  static char buf[BUFSIZ];
  /* set stdin to line buffered */
  setvbuf(stdin, buf, _IOLBF, sizeof buf);
  /* ... */
}

Anyway, I prefer this to using read and write, because it restricts the non
Standard functions to select() (which is encapsulated in one system specific
function), and because the Standard functions are a bit less work to use.





This page took 0.02 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.