ANSI C /K&R 2nd edition questions,...

Doug Gwyn gwyn at smoke.brl.mil
Sat Apr 13 07:52:01 AEST 1991


In article <1991Apr11.234342.6190 at milton.u.washington.edu> rburgess at milton.u.washington.edu (Rick Burgess) writes:
>are the "Symbolic constants" (VAX/VMSpeak) EPERM, ENOENT, ESRCH,... which are
>defined in errno.h in VMS, and apparently also under the standard dynix 
>compiler on a machine we have here, are these ANSI standard?

No, of course not.  The only errno values in the C standard are EDOM and
ERANGE.

>Neither can I find "access(char *file_spec, int mode);", which is supposed to
>be a more elegant way to check the existance and protection on files.

The whole idea of protection modes, file owner, etc. is highly operating
system specific.  access() originated in UNIX, where it seldom does the
thing that the application is trying to use it for (just a design botch
for the access() semantics, in my opinion).

>If there should be a general or common opinion that the 2nd edition of K&R is
>not adequate for knowing the ANSI standard, can anyone recommend something
>readable/usable?

Yes, you should have a copy of the actual standard for reference
purposes.  There is also a little book out by Brodie and Plauger
(if I recall correctly) entitled something like "Standard C",
that is pretty good for detailed tutorial purposes.

>Should there be recommendations against using access(), is there some kind of
>standard convolution with fopen() or something that is recognized as a good
>and clear and/or "the way" to do what access would do?

Usually you can just try the particular form of access you intend,
and take measures based on whether or not it reports an error.



More information about the Comp.lang.c mailing list