Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Engine programming - standard input

Author: Dieter Buerssner

Date: 11:41:44 12/03/03

Go up one level in this thread


On December 03, 2003 at 12:51:53, Robert Hyatt wrote:

>On December 03, 2003 at 11:55:37, Dieter Buerssner wrote:
>
>>I guess Robert means read(). As said above, I would prefer Standard C functions
>>(if possible). read() is not a Standard C function.
>
>I'm not sure what that means.

It means, read() is not part of the international Standard ISO/IEC 9899:1990 and
ISO/IEC 9899:1999, and the previous ANSI C Standard.

>read() is in every C implementation I have
>ever used.  As are the others such as getc/putc, gets/puts, scanf/printf,
>fread/fwrite, read/write, etc...  read/write are specifically non-buffered
>calls, and they even worked on MSDOS just fine.

There were many subtle differences between different systems when I last used
the Unix type open/close/read/write type functions (for example, does it default
to binary or text mode? Which headers to include? I remember vaguely some
specific VMS, MVS and MAC-OS problems.) It is a long time ago, however, since I
used this.

I just looked up read() in my MSVC documentation, and could not find it. Only
_read() seems to be documented there (doing the things expected for read()).
Same for _open/_creat/_write.

The K+R chapter where these functions were described was called "The Unix System
Interface", and this chapter was not there anymore in the 2nd edition of that
famous book (IIRC - my book was stolen from my desk, so I cannot check it
anymore).

So, when there is a Standard C way to do it, why should one use more or less a
POSIX specific method (for newly written code)?

Regards,
Dieter



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.