Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!husc6!seismo!mcvax!enea!tut!intrin!oae From: oae@intrin.UUCP Newsgroups: comp.lang.c Subject: A question about stdin, stdout and stderr Message-ID: <487@intrin.UUCP> Date: Fri, 20-Feb-87 08:29:03 EST Article-I.D.: intrin.487 Posted: Fri Feb 20 08:29:03 1987 Date-Received: Thu, 26-Feb-87 22:23:47 EST Reply-To: oae@intrin.UUCP (Olavi Eerola) Organization: Intrinsic Oy, Tampere, FINLAND Lines: 39 Keywords: standard-io lex vms vax c I have a problem. I generated a program with lex on ULTRIX and moved that program to VMS. On VMS I got an error message from the next line: FILE *yyin = {stdin}, *yyout = {stdout}; The VMS's C compiler didn't translate these initializations, because stdin and stdout are variables on VMS. On ULTRIX they are constants. Then I examined The Father, The Son and The Holy Ghost and found the following: 1. The K&R, p 153, says: "The file pointers stdin and stdout are pre-defined in the I/O library as the standard input and standard output; they may be used anywhere an object of type FILE * can be. The are constants, however, not variables, so don't try to assign to them." 2. Harbison, Steele: A C Reference Manual, p 316, says: "11.5.32 stdin ..., the external variable stdin will contain a stream that..." "11.5.33 stdout ..., the external variable stdout will contain a stream that..." 3. As for I know the draft ANSI C standard says that stdin, stdout and stderr are expressions. So, are they constants, variables or expression? I think that The K&R has the only right definition for stdin, stdout and stderr, the others are wrong. Olavi Eerola oae@intrin.uucp Intrinsic Oy Aleksis Kiven katu 11 C SF-33100 Tampere, Finland +358-31-132800