Author: Matt Thomas
Date: 23:05:13 12/03/03
Go up one level in this thread
On December 03, 2003 at 14:41:44, Dieter Buerssner wrote: >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)? > I found my Bjarne Stroustrup book (yay) and it shows read() as one of the standard iostream functions. So it must be ANSI/ISO. (maybe) I seem to remember back then there were some changes to the standard, so I hope that my book isn't too dated. In the book read() is deemed to be a sound means of handling unbuffered input. I found it in my version of VC6 and is located in iostream.h, istream class. I like it because it is designed for handling unbuffered input. Its a relief to see that because it looks difficult to replace its function. I lock up my stuff at work. Not that I don't trust no-one, its just that I like to lock stuff up... -Matt
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.