rsalz@bbn.com (Rich Salz) (04/18/89)
In <207600018@s.cs.uiuc.edu> carroll@s.cs.uiuc.edu writes: > why can't you switch stdin by having another variable >FILE *tmp; >and doing >tmp = stdin; stdin = my_file; do_stuff(); stdin = tmp; Because |stdin| is not required to be an lvalue. On many standard i/o implementations you have this in <stdio.h>: #define stdin &_iob[0] and that means |stdin| can't appear on the left side of an assignment statement. This was mentioned in K&R1 and (I believe) is also allowable in ANSI and Posix. (For those who care, on VMS stdin/stdout/stderr are variables; this makes most lex output uncompileable without massaging.) /r$ -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.